Setting a Conditional Breakpoint
See Also
You can set conditions on a breakpoint so that execution only breaks if the
condition is true. You can set conditions on any breakpoint except thread breakpoints
by selecting the Conditions checkbox and entering the condition.
For all breakpoints you can specify how often the breakpoint is triggered by selecting the
Break When Hit Count checkbox and choosing a criteria from the drop-down list and specifying a numerical value.
Class breakpoints and exception breakpoints allow you to set the following conditions:
- For class breakpoints you can exclude classes triggering the breakpoint by selecting the Exclude classes checkbox and
specifying the classes to exclude.
- For exception breakpoints you can filter the classes triggering the breakpoint by selecting the
Filter on Classes Throwing the Exception checkbox and specifying the names of classes to match or exclude.
To set conditions on a breakpoint:
- Create a new breakpoint or open an existing breakpoint's customizer
by right-clicking its name in the Breakpoints window and choosing Customize.
- Select the Condition checkbox and type the condition in the Condition field. The condition must follow the
Java syntax rules. The condition may include anything that can be on the right
side of the equal sign (=). The condition may also include variables
and methods that are within the current context. The following are exceptions:
- Imports are ignored. You must use fully qualified names, such as obj instanceof java.lang.String.
- You cannot access outerclass methods and variables directly. Use this.variableName or this$1.
- (Optional) Select the Break When Hit Count checkbox and choose a criteria from the drop-down list and specify a numerical value.
Conditional line breakpoints have a
icon in the left margin of the Source Editor.
- See Also
- Breakpoints in the IDE
- Setting a Java Breakpoint
- Organizing Breakpoints Into a Group
- About Debugging Java Applications
Legal Notices