Thread thread = new Thread( new Uncaught() );
thread.setUncaughtExceptionHandler(
new Thread.UncaughtExceptionHandler() {
public void uncaughtException( Thread t, Throwable e ) {
System.err.println( t + " threw exception: " + e );
}
} );
thread.start();