Move the 32-bit VM check from HostedModeBase to SwtHostedModeBase so it runs
earlier, avoiding a less informative failure mode..
Review by: jat
git-svn-id: https://google-web-toolkit.googlecode.com/svn/releases/1.7@6189 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src-dummy/com/google/gwt/dev/BootStrapPlatform.java b/dev/core/src-dummy/com/google/gwt/dev/BootStrapPlatform.java
index f38d4e1..3d2fc28 100644
--- a/dev/core/src-dummy/com/google/gwt/dev/BootStrapPlatform.java
+++ b/dev/core/src-dummy/com/google/gwt/dev/BootStrapPlatform.java
@@ -29,7 +29,7 @@
// nothing to do
}
- public static void initHostedMode(boolean is32Bit) {
+ public static void initHostedMode() {
// nothing to do.
}
}
diff --git a/dev/core/src/com/google/gwt/dev/HostedModeBase.java b/dev/core/src/com/google/gwt/dev/HostedModeBase.java
index a361016..060878c 100644
--- a/dev/core/src/com/google/gwt/dev/HostedModeBase.java
+++ b/dev/core/src/com/google/gwt/dev/HostedModeBase.java
@@ -343,13 +343,6 @@
}
}
- /**
- * Determine if we're using a 32 bit runtime.
- */
- private static boolean is32BitJvm() {
- return "32".equals(System.getProperty("sun.arch.data.model"));
- }
-
protected final HostedModeBaseOptions options;
/**
@@ -366,7 +359,7 @@
public HostedModeBase() {
// Set any platform specific system properties.
- BootStrapPlatform.initHostedMode(is32BitJvm());
+ BootStrapPlatform.initHostedMode();
BootStrapPlatform.applyPlatformHacks();
options = createOptions();
}
diff --git a/dev/core/src/com/google/gwt/dev/SwtHostedModeBase.java b/dev/core/src/com/google/gwt/dev/SwtHostedModeBase.java
index a737d3b..f4af2ea 100644
--- a/dev/core/src/com/google/gwt/dev/SwtHostedModeBase.java
+++ b/dev/core/src/com/google/gwt/dev/SwtHostedModeBase.java
@@ -73,14 +73,43 @@
}
}
}
-
+
static {
+ /*
+ * The following check must be made before attempting to start SWT, or we'll fail with a
+ * less-than-helpful UnsatisfiedLinkError.
+ */
+ if (!is32BitJvm()) {
+ System.err.println("You must use a 32-bit Java runtime to run GWT Hosted Mode.");
+ if (isMacOsX()) {
+ // Provide an extra hint for Mac users due to previous GWT incompatibiity with Snow Leopard
+ System.err.println(" Leopard: Use the Java 1.5 runtime.");
+ System.err.println(" Snow Leopard: Use the Java 1.6 runtime and add the -d32 flag.");
+ }
+ System.exit(1);
+ }
+
// Force ToolBase to clinit, which causes SWT stuff to happen.
new ToolBase() {
};
// Correct menu on Mac OS X
Display.setAppName("GWT");
}
+
+ /**
+ * Determine if we're using a 32 bit runtime.
+ */
+ private static boolean is32BitJvm() {
+ return "32".equals(System.getProperty("sun.arch.data.model"));
+ }
+
+ /**
+ * Determine if we're using Mac OS X.
+ */
+ private static boolean isMacOsX() {
+ String osName = System.getProperty("os.name").toLowerCase();
+ return osName.startsWith("mac os x");
+ }
private BrowserWidgetHostImpl browserHost = new SwtBrowserWidgetHostImpl();
diff --git a/dev/linux/src/com/google/gwt/dev/BootStrapPlatform.java b/dev/linux/src/com/google/gwt/dev/BootStrapPlatform.java
index bf94eec..f3313c4 100644
--- a/dev/linux/src/com/google/gwt/dev/BootStrapPlatform.java
+++ b/dev/linux/src/com/google/gwt/dev/BootStrapPlatform.java
@@ -36,12 +36,7 @@
* it. If successful, store the loaded path in the property swt.mozilla.path
* so SWT's Browser object can use it.
*/
- public static void initHostedMode(boolean is32Bit) {
- if (!is32Bit) {
- System.err.println("You must use a 32-bit runtime to run GWT Hosted Mode.");
- System.exit(1);
- }
-
+ public static void initHostedMode() {
String home = System.getenv("HOME");
if (home == null || home.length() == 0) {
System.err.println("The HOME environment variable must be defined.");
diff --git a/dev/mac/src/com/google/gwt/dev/BootStrapPlatform.java b/dev/mac/src/com/google/gwt/dev/BootStrapPlatform.java
index e9012f5..c0fca46 100644
--- a/dev/mac/src/com/google/gwt/dev/BootStrapPlatform.java
+++ b/dev/mac/src/com/google/gwt/dev/BootStrapPlatform.java
@@ -64,18 +64,7 @@
Toolkit.getDefaultToolkit();
}
- public static void initHostedMode(boolean is32Bit) {
- /*
- * The following check must be made before attempting to initialize Safari,
- * or we'll fail with an less-than-helpful UnsatisfiedLinkError.
- */
- if (!is32Bit) {
- System.err.println("You must use a 32-bit runtime to run GWT Hosted Mode.");
- System.err.println(" Leopard: Use the Java 1.5 runtime.");
- System.err.println(" Snow Leopard: Use the Java 1.6 runtime and add -d32");
- System.exit(-1);
- }
-
+ public static void initHostedMode() {
LowLevelSaf.init();
// Ensure we were started with -XstartOnFirstThread
if (!hasStartOnFirstThreadFlag(LowLevelSaf.getProcessArgs())) {
diff --git a/dev/windows/src/com/google/gwt/dev/BootStrapPlatform.java b/dev/windows/src/com/google/gwt/dev/BootStrapPlatform.java
index 8734d98..f2a7601 100644
--- a/dev/windows/src/com/google/gwt/dev/BootStrapPlatform.java
+++ b/dev/windows/src/com/google/gwt/dev/BootStrapPlatform.java
@@ -28,10 +28,6 @@
// nothing to do
}
- public static void initHostedMode(boolean is32Bit) {
- if (!is32Bit) {
- System.err.println("You must use a 32-bit runtime to run GWT Hosted Mode.");
- System.exit(1);
- }
+ public static void initHostedMode() {
}
}