2004/01/19 21:12:25
[org.ibex.core.git] / src / org / xwt / Platform.java
index af837a4..6e76b3f 100644 (file)
@@ -32,13 +32,11 @@ public abstract class Platform {
 
     // VM Detection Logic /////////////////////////////////////////////////////////////////////
 
-    public static void forceLoad() { }                 ///< do-nothing method that forces &lt;clinit&gt; to run
-
     // If you create a new subclass of Platform, you should add logic
     // here to detect it. Do not reference your class directly -- use
     // reflection.
 
-    static {
+    public static void forceLoad() {
         System.err.print("Detecting JVM...");
         try {
             String vendor = System.getProperty("java.vendor", "");
@@ -62,7 +60,11 @@ public abstract class Platform {
             }
             
             System.err.println(" " + os_name + " ==> org.xwt.plat." + platform_class);
-            if (platform_class != null) Class.forName("org.xwt.plat." + platform_class).newInstance();
+            try {
+                if (platform_class != null) Class.forName("org.xwt.plat." + platform_class).newInstance();
+            } catch (InstantiationException e) {
+                throw e.getCause();
+            }
 
             String term = Platform.getEnv("TERM");
             Log.color = term != null && term.length() != 0 && !term.equals("cygwin");
@@ -84,7 +86,7 @@ public abstract class Platform {
             Log.diag(Platform.class, "                     class = " + platform.getClass().getName());
             platform.postInit();
 
-        } catch (Exception e) {
+        } catch (Throwable e) {
             Log.error(Platform.class, "Exception while trying to detect JVM");
             Log.error(Platform.class, e);
             criticalAbort("Unable to detect JVM");