Debugging based on Exception in Breakpoints Eclipse

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:
[java]
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);
}

}
[/java]

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:

Leave a Reply