Breakpoint Enable Condition

Select the Conditional option to enable the ability to provide a custom condition for the breakpoint.

Each breakpoint can have a unique condition that determines when the breakpoint will be hit.

A condition for a breakpoint can be any logical expression that evaluates to either true or false. The expression is evaluated in the scope of the breakpoint location, meaning you cannot make reference to a class, etc., outside the scope of the breakpoint location when composing your expression.

Consider the following example:

public class Person {

	String name = "";
	int age = 0;

	public Person(String name, int age) { = name;
		this.age = age;		//breakpoint here

If we take the above example, place a breakpoint where indicated and go to the breakpoint properties we can add our condition. In this case we are limited only to the members of the class the breakpoint is contained in and those provided by Object.

For example a valid condition could be:

	age == 56 

meaning the breakpoint would only suspend when age was equal to 56.

Conditions can be added to breakpoints in the Breakpoints View detail pane or with the Breakpoints Properties... shown below.

Breakpoint condition option


Related concepts


Related tasks

Adding breakpoints
Removing breakpoints
Launching a Java program
Running and debugging

Related reference

Enabled Option
Hit Count
Suspend Policy
Method Entry
Method Exit