Debugging based on Exception in Breakpoints Eclipse

(Last Updated On: August 11, 2016)

we know how to debug in eclipse using breakpoints, Now we are going to learn how to debug based on exceptions in eclipse,

Window -> Show view -> Breakpoints

It will look like this,

breakpoint

click “Add Java Exception Breakpoint” icon as mentioned in the above screenshot,
exception

Sample Java Program:

package in.javadomain;

public class BreakPointException {

	public static void main(String[] args) {
		int a = 10;
		int b = 0;
		int c = a / b;
		System.out.println("Ans:::" + c);
	}

}

And configure the ArithmeticException in the breakpoint,
arithmetic exception

And Now Rightclick on the above java file
Debug As -> Java Application

When arithmetic exception occured, it will be automatically stop in that point like below,
exception occured

Recommended Books:

235 total views, 0 views today

Leave a Reply

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