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

烂漫一生 提交于 2019-12-05 14:17:32

问题


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



来源:https://stackoverflow.com/questions/15866558/how-can-i-make-eclipse-to-break-on-all-uncaught-exceptions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!