Breakpoints in the IDE
See Also
A breakpoint is a flag in the source code that tells the debugger to stop
execution of the program. When your program stops on a breakpoint, you can
perform actions like examining the value of variables and single-stepping through
your program.
The IDE enables you to set several types of breakpoints using the New Breakpoint
dialog. You can also set line breakpoints directly in the Source Editor. Breakpoints
can be set for the following types of source elements:
- Class. You can break when the class is loaded into the virtual machine,
unloaded from the virtual machine, or both.
- Exception. You can break whenever a specific exception is caught,
whenever a specific exception is not handled in the source code, or whenever
any exception is encountered regardless of whether the program handles the
error or not.
- Variable. You can stop execution of your program whenever a variable
in a specific class and field is accessed (for example, the method was called
with the variable as an argument) or modified.
- Method. Program execution stops every time the method is executed.
- Thread. You can break program execution whenever a thread starts,
stops, or both.
The Source Editor indicates a breakpoint by highlighting the line at which the
breakpoint is set in red and placing an annotation in the left margin. The
following table describes the debugging annotations.
Annotation |
Description |
 | Breakpoint |
 | Disabled breakpoint |
 | Multiple breakpoints |
 | Conditional breakpoint |
 | Disabled conditional breakpoint |
 | Program counter |
 |
Program counter and one breakpoint |
 |
Program counter and multiple breakpoints |
 | The call site or place in the source code from which
the current call on the call stack was made |
- Except for line breakpoints, 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.
You can view and organize all IDE breakpoints by choosing Windows > Debugging > Breakpoints
(Alt-Shift-5).
- See Also
- Setting a Java Breakpoint
- Organizing Breakpoints Into a Group
- About Debugging Java Applications
Legal Notices