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:
- Click in the left margin next to the line in the source code or put the insertion point in the line and press Ctrl-F8.
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:
- 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.
- Choose Debug > New Breakpoint (Ctrl-Shift-F8).
The New Breakpoint dialog box opens with a suggested breakpoint type and target filled in.
- If necessary, adjust the suggested breakpoint type in the Breakpoint Type drop-down list.
- Enter the package and class name for which you want to set the breakpoint.
- 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:
- Choose Window > Debugging > Breakpoints (Alt-Shift-5) to open the Breakpoints window.
- Right-click any breakpoint and choose Properties to open the Breakpoint Properties dialog box.
- 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:
- Right-click the breakpoint in the Breakpoints window and choose Enable or Disable.
Notes:
- You can modify and enable line, field and method breakpoints by right-clicking the breakpoint
icon in the left margin of the Source Editor and choosing from the Breakpoint submenu.
- When a debugging session is running, you can use code completion in the New Breakpoint dialog box.
- See Also
- Breakpoints in the IDE
- Setting a Conditional Breakpoint
- Organizing Breakpoints Into a Group
- About Debugging Java Applications
Legal Notices