UncaughtExceptions are sent to the ThreadGroup.uncaughtException(Thread, Throwable) method. You can override this method for new Threads and catch all uncaught exception that way.
For the main thread you can just add in the main()
try {
// some code.
} catch (Throwable everything) {
everything.printStackTrace(System.err);
}