Is there any way (including a third-party plug-in) to make a Java exception breakpoint in Eclipse that only breaks if a condition is true?
Current Use Case: I am trying to catch a ClassNotFoundException
for a particular class in order to debug a class loading issue. Unfortunately, my breakpoint is trapping literally thousands of irrelevant routine exceptions that occur on Tomcat startup. I want to tell Eclipse to break only if -1 < e.getMessage().indexOf(MY_CLASS_NAME)
.
Help!?
Update: Several answers have suggested to right-click on the exception in the exception properties and click conditional breakpoint. I've already tried this. Up to at least Eclipse Luna Release 2 (v 4.4.2, build id 20150219-0600), this is not option available for exception breakpoints.
For clarity, here is a picture of my exception breakpoint's properties:
There is no option to add a condition for an exception breakpoint similar to normal breakpoints. The closest thing you can do is use the Filtering properties page to add a filter on the breakpoint such as the class and/or the package which throws the exception. Or you can filter on 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 more info.
Right click on your break point! -> Properties -> Conditional break point
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With