/** * Initializes the default uncaught exception handler as early as possible. */ @PureWithSideEffects @Initialize(target = UtilityInitializer.class) public static void initializeDefaultUncaughtExceptionHandler() throws FileNotFoundException { // NetBeans 8.1 crashes if you use type annotations on anonymous classes and lambda expressions! Thread.setDefaultUncaughtExceptionHandler((Thread thread, Throwable throwable) -> Log.fatal("The following problem caused this thread to terminate.", throwable)); }