Catch all unhandled errors
@@ -40,8 +40,8 @@ public class MainLoader {
private static final float VERSION_REFERENCE_VAL = 1.7f;
- public static void main(String[] args) throws IllegalArgumentException, InvocationTargetException,
- ClassNotFoundException, NoSuchMethodException {
+ public static void main(String[] args) {
+ try {
// check if java version is sufficient
if (! checkJavaVersion(VERSION_REFERENCE_VAL)) {
String msg = getBundle().getString("MainLoader.invalid_java_version");
@@ -87,6 +87,16 @@ public class MainLoader {
msg(title, msg);
System.exit(1);
}
+ } catch (Throwable ex) {
+ // print stacktrace just to make sure we don't miss it
+ ex.printStackTrace(System.err);
+
+ String msg = "An unhandled error occured.\n\n";
+ msg += ex.getClass().getName() + ": " + ex.getMessage();
+ String title = "Error starting the application";
+ msg(title, msg);
+ System.exit(1);
+ }
}
private static ResourceBundle getBundle() {
