Visual Studio has an option to break automatically into the debugger when an unhandled exception is thrown, does Eclipse have similar functionality?
Asked
Active
Viewed 7.9k times
254
-
6Would http://stackoverflow.com/questions/587612/catching-exceptions-as-an-expression-while-debugging-java-in-eclipse-ide help? – VonC Jun 17 '10 at 23:04
-
9good one, I didnt 'catch' that in my pre-post searching – keithwarren7 Jun 17 '10 at 23:20
2 Answers
320
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
")

VonC
- 1,262,500
- 529
- 4,410
- 5,250
-
12What isn't clear here is whether the debugger will break on ANY exception when "Suspend on uncaught exceptions" is checked off. In the example above, does it mean break on any uncaught exceptions of the type "ActivationException", or does it mean break on any uncaught exception of any type? Very poorly described. – Johann Jun 10 '13 at 14:00
54
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

Carles Barrobés
- 11,608
- 5
- 46
- 60
-
1
-
1@JaySullivan It's on the far right, so if the pane is too small, you will need to expand it. It's the circled icon on the top right of the screenshot in the [accepted answer](http://stackoverflow.com/a/3066280/3714913). – Nateowami Jul 12 '15 at 07:51
-
1The **Window/Preference/java/debug** solution is a really good complement to the accepted answer, this answer deserve more upvotes. – pdem May 18 '16 at 07:31
-
1**You also need:** `Subclasses of this exception` checked - got that from here: https://stackoverflow.com/a/15866667/1599699 – Andrew Dec 12 '17 at 19:51