Setting a Java Breakpoint

See Also

All Java breakpoints are defined globally and therefore affect all IDE projects that include the source on which a breakpoint is set. For example, if you set a class breakpoint on com.me.MyClass in one project, the IDE will stop execution every time it encounters that class during a debugging session for other projects that include the class.

To set a line, field or method breakpoint in the Source Editor:

A field, method or line breakpoint is created depending on if the line contains a field declaration, method declaration or other code. The corresponding breakpoint annotation is visible in the left margin next to the line of source code.

The IDE tests the validity of set breakpoints when the debugger session is starting or when a debugger session is already running. If a breakpoint is invalid the IDE uses a broken annotation to indicate the invalid breakpoint and displays an error message in the Debugger Console.

To set all other types of breakpoints:

  1. In the Source Editor, select the code element on which you want to set a breakpoint. For example, if you want to set a class breakpoint on the class BeanCounter, select the class name in the class declaration.
  2. Choose Debug > New Breakpoint (Ctrl-Shift-F8).

    The New Breakpoint dialog box opens with a suggested breakpoint type and target filled in.

  3. If necessary, adjust the suggested breakpoint type in the Breakpoint Type drop-down list.
  4. Enter the package and class name for which you want to set the breakpoint.
  5. Set any additional options you require in the New Breakpoint dialog and click OK.

    The IDE creates the new breakpoint for the selected source element.

To modify an existing breakpoint:

  1. Choose Window > Debugging > Breakpoints (Alt-Shift-5) to open the Breakpoints window.
  2. Right-click any breakpoint and choose Properties to open the Breakpoint Properties dialog box.
  3. Adjust any settings or actions you require and click OK.

    The IDE updates the breakpoint for the selected source element.

To enable and disable a breakpoint:

Notes:

See Also
Breakpoints in the IDE
Setting a Conditional Breakpoint
Organizing Breakpoints Into a Group
About Debugging Java Applications

Legal Notices