Apache NetBeans Wiki Index

Note: These pages are being reviewed.

How can I suppress the Unexpected Exception dialog?

If your code generates an uncaught exception at runtime or uses Logger.log(Level l, String s, Throwable t) with level ⇒ 900 (Level.WARNING), NetBeans will display a dialog box which can show the details of that exception to the user. This is a welcome alternative to simply crashing the application, and provided you have written solid code, your user should never see this dialog anyway.

But it is impossible to handle every possible exception or error, and some developers might wish to simply suppress this dialog so that the application neither crashes nor alerts the user that an uncaught exception/error was thrown. You can do this by setting a system property at runtime named netbeans.exception.report.min.level. The exact value of this property will depend on certain factors such as whether or not assertions are enabled, but using a very high value such as 99999 should prevent the dialog from ever being shown automatically.

The above on its own doesn’t suppress the exception dialog entirely - the dialog will still be shown if the user clicks on the error icon. To suppress that too, set netbeans.exception.alert.min.level to a high value as well (i.e. 99999). This means your users will not even know there was a problem, and will have no opportunity to find out (or report it) unless they scan their log file.

See http://forums.netbeans.org/ptopic16746.html for details on how to set properties within NetBeans and in final applications.

Apache Migration Information

The content in this page was kindly donated by Oracle Corp. to the Apache Software Foundation.

This page was exported from http://wiki.netbeans.org/DevFaqUnexpectedExceptionDialog , that was last modified by NetBeans user Jglick on 2011-08-29T14:59:19Z.

NOTE: This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.