We'd like a trace in our application logs of these exceptions - by default Java just outputs them to the console.
Since Java 7, you have to do it differently as the sun.awt.exception.handler hack does not work anymore.
sun.awt.exception.handler
Here is the solution (from Uncaught AWT Exceptions in Java 7).
// Regular Exception Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler()); // EDT Exception SwingUtilities.invokeAndWait(new Runnable() { public void run() { // We are in the event dispatching thread Thread.currentThread().setUncaughtExceptionHandler(new ExceptionHandler()); } });
2.1m questions
2.1m answers
60 comments
57.0k users