How can I make Eclipse to break on ALL uncaught ex

2019-04-03 23:35发布

问题:

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.

  • Exception
  • Throwable
  • Error

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?

回答1:

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.



回答2:

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.



回答3:

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