Setting a Breakpoint on an Exception
You have several options for setting a breakpoint on an exception.
- Break whenever a specific exception is caught
- Break whenever a specific exception is not handled in the source code
- Break whenever any exception is encountered regardless of whether the program handles the error or not
To set a breakpoint on an exception:
- From the main menu, choose Debug
Add Breakpoint (Ctrl-Shift-F8).
- In the Add Breakpoint dialog box, select Exception from the Breakpoint
Type combo box.
- Specify the breakpoint settings:
- Package Name. If this field is not already filled in, enter the package name.
- Exception Class Name. Enter the full class name (for example, java.lang.InternalError) of the exception or error.
- Stop on. Specify how to handle the exception. You can break when the exception is caught, when the exception is not handled, or on all exceptions.
- Condition. To set a condition so the breakpoint occurs when an expression evaluates to true, type a Boolean expression in this text field.
- Specify the actions to take when the breakpoint is hit:
-
Suspend Debugging. If selected, all threads in the debugging session are temporarily stopped when the program reaches the breakpoint.
- Print Text. If selected, the specified message is printed in the Output window
when the breakpoint is hit. You can use a combination of text,
substitution codes, curly braces and a dollar sign in the message
(for example, {$mywatch}).
- Click OK.
The breakpoint is added to the Breakpoints view of the Debugger
window.
Legal Notices