Break when exception is thrown

JavaEclipseDebuggingEclipse Jdt

Java Problem Overview


Visual Studio has an option to break automatically into the debugger when an unhandled exception is thrown, does Eclipse have similar functionality?

Java Solutions


Solution 1 - Java

You are able to define the precise list of Exception you want to have a breakpoint on, even if those exceptions are uncaught (which should be the equivalent of "unhandled")

uncaught

Solution 2 - Java

Go to the breakpoints window, there's a button that looks like J!, there you can set breakpoints for Java exceptions, either caught or uncaught. You can reference classes or use pattern matchers for exception names.

Also, under Window -> Preferences, Select Java -> Debug and there's a checkbox to tell the debugger to break on uncaught exceptions

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionkeithwarren7View Question on Stackoverflow
Solution 1 - JavaVonCView Answer on Stackoverflow
Solution 2 - JavaCarles BarrobésView Answer on Stackoverflow