Setting a Breakpoint on an Exception

  1. From the main menu, choose Debug New Breakpoint (Ctrl-Alt-F8).

  2. In the Add Breakpoint dialog box, choose Exception from the Breakpoint type combo box.

  3. Type the full class name (for example, java.lang.InternalError) in the Exception class name text field.

  4. From the Stop on combo box, choose how to handle exceptions.

    You can choose to have only exceptions that are caught stop the debugger, only unhandled exceptions stop the debugger, or all exceptions stop the debugger,

  5. To set a condition (so the breakpoint occurs when an expression evaluates to true), type the expression in the Condition text field (available with the JPDA only).

  6. Select the desired actions:
    Suspend debugging temporarily stops all threads in the debugging session when the program reaches the breakpoint.
    Print text prints a message in the Output window when it reaches the breakpoint. You can use a combination of text, substitution codes, curly braces and a dollar sign in the message (for example, {$mywatch}).

  7. Click OK.

    The breakpoint is added to the list in the Breakpoints pane of the Debugger window.
See also
Setting a Breakpoint on a Line
Setting a Breakpoint on a Method Name
Setting a Breakpoint on a Class
Setting a Breakpoint on a Thread
Setting a Breakpoint on a Variable

Legal Notices