How to use conditional breakpoint in eclipse (step by step)

How to use conditional breakpoint in eclipse (step by step)

We can say no developers in the world who developing without debugging his/her code. We have lot of debugging options to make use the debugging option more effectively.

Here we are going to see how we can debug with conditional breakpoints.
Step 1:
Below is the very simple program to explain the conditional breakpoint,

package in.javadomain;
public class ConditionalBreakpoint {
	public static void main(String[] args) {
		boolean value = false;
		System.out.println("Debug, if condition given in the breakpoint condition satisfies ");


Step 2:
Put the breakpoint in the sysout line of the above program.

Step 3:
Right click on the breakpoint and click breakpoint properties (or) control+double click on the breakpoint, then click the Breakpoint properties -> Enable the Conditional checkbox -> click suspend when true radio button.
Then add the condition,
setting breakpoint

Now Run as debug and see the output for both the conditions (value==false and value==true) below,

when value==true
conditional breakpoint

when value==false

After changing the breakpoint conditions, ensure you have saved it.

Recommended Java Books:

587 total views, 1 views today

Leave a Reply

Your email address will not be published. Required fields are marked *