Exception Breakpoints

It's often useful to stop execution of an application when an exception occurs, and inspect the state of the app in debugger. It is very simple to do: setup an exception breakpoint and just run the application via debugger (or attach to an running application).

To setup an exception breakpoint:

  1. Go to menu Debug | New Breakpoint (Ctrl+Shift+F8).
  2. In the New Breakpoint dialog select the Exception breakpoint type from the combobox.
  3. Enter the exception to track (fully qualified class name).
  4. You can modify the other properties too.

Typically you want to watch for some general exception superclass, e.g. java.lang.Exception, or exceptions that do not have to be handled, e.g. java.lang.AssertionError, or java.lang.RuntimeException.

In a bigger application you may want to narrow the scope of classes to watch for exceptions only from your classes, not to stop on exceptions from JDK internals or other code. You can set a match or exclude class filter in the Filter on Classes Throwing the Exception option of the breakpoint dialog.

Applies to: NetBeans 6.x

Platforms: All

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo