Java exception checkpoint with condition in Eclipse
Is there any way (including a third party plugin) to create a Java exception breakpoint in Eclipse that only breaks if the condition is true ?
Current use case. I am trying to catch ClassNotFoundException
for a specific class to debug a class loading problem. Unfortunately my breakpoint is catching literally thousands of irrelevant routine exceptions that are thrown when Tomcat starts up. I want to tell Eclipse to only crash if -1 < e.getMessage().indexOf(MY_CLASS_NAME)
.
Help!
Update . Several answers suggested right clicking on the exception in the properties of the exception and clicking a conditional breakpoint. I've already tried this. Until at least Eclipse Luna Release 2 (v 4.4.2, build id 20150219-0600), this is not a breakpoint exception option .
For clarity, here is a picture of the properties of an exception breakpoint:
source to share
There is no way to add a condition for an exception breakpoint like normal breakpoints. The closest thing you can do is use the Filtering property page to add a filter to the breakpoint, such as the class and / or package that throws the exception. Or you can filter by a specific thread while debugging.
See http://help.eclipse.org/juno/topic/org.eclipse.jdt.doc.user/tasks/tasks-create-exception-filter-expression.htm for details .
source to share