Catching Java Exceptions

It is possible to suspend the execution of thread when an exception is thrown by specifying an exception breakpoint. Execution can be suspended at locations where the exception is uncaught, caught, or both.

  1. Choose Add Java Exception Breakpoint from the Breakpoints View or the workbench Run menu.  

  2. A dialog listing all of the available exceptions is presented (see the following figure).



  3. Type the name of the exception you want to catch or select it from the list.

  4. At the bottom of the page, use the checkboxes to specify how you want execution to suspend at locations where the exception is thrown.

    • Select Caught if you want execution to suspend at locations where the exception is thrown and caught by a catch clause.

    • Select Uncaught if you want execution to suspend at locations where the exception is uncaught.

Note: Exception breakpoints can be enabled and disabled and have hit counts just like regular breakpoints.


Java development tools (JDT)
Breakpoints

Creating Exception Breakpoint Filters
Suspending threads
Adding breakpoints
Removing breakpoints
Enabling and disabling breakpoints
Setting method breakpoints


Breakpoints view
Add Java exception breakpoint