eonil
eonil

Reputation: 85975

How can I make Eclipse to break on ALL uncaught exceptions?

I am writing a Java program using Eclipse Juno.

When I run the program, and it meets an exception, program just dies with back trace. I set these exception breakpoint to debug at time for any unexpected exceptions.

but, anyway, still I see some uncaught exceptions just makes program crashes instead of breaks by Eclipse. I want to break for any uncaught exceptions. But I can't find option to choose ALL exceptions. How can I make Eclipse to break on any exceptions?

Upvotes: 19

Views: 8897

Answers (3)

Yoon Lee
Yoon Lee

Reputation: 2039

  1. Window->Show View->Other
    1
  2. Search for breakpoints which appears Debug->Breakpoints
    2
  3. Now add Throwable Exception by pressing J! icon
    3
  4. Add Exception
    4

Upvotes: 6

Alexander Suraphel
Alexander Suraphel

Reputation: 10613

You need to Go to Breakpoints view > Add Java Exception Breakpoint then search for Throwable it will come up with java.lang.Throwable. Add java.lang.Throwable and check Subclasses of this exception just as @Eonil did.

enter image description here

Upvotes: 7

eonil
eonil

Reputation: 85975

Finally I found it!

I had to explicitly set subclasses of this exception checkbox for each exception in Breakpoints pane.

Also, I need to set NullPointerException's caught locations too or even uncaught exceptions won't be caught.

enter image description here

Upvotes: 23

Related Questions