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,
click “Add Java Exception Breakpoint” icon as mentioned in the above screenshot,
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,
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,
Recommended Books: