Setting a Breakpoint Before Starting the Debugger

   

After you have created and built your Visual J++ project, you can set breakpoints in your code. A breakpoint designates a location in your code at which the code temporarily stops executing so that you step through your code line by line, examining variable values, examining application behavior. Where a bug occurs in your application, you can set a breakpoint that enables you to halt your program just before the unexpected behavior occurs.

To set a breakpoint and start the debugger

  1. With your source code file open in the editor, place the cursor on any executable code in your application, applet, or component.

  2. Click the right mouse button and select Insert Breakpoint from the shortcut menu.

    A solid red circle is placed in the margin of the editor indicating a breakpoint was set on the statement you just selected.

  3. On the Debug menu, click Start or use the keyboard shortcut, F5.

    The program runs and stops (breaks) just before it executes the line on which you’ve set the breakpoint. The yellow arrow in the margin indicates the next statement to be executed.

When your program is in break mode, you can:

To resume the debugging session

To end the debugging session