hotspot/src/os/windows/vm/os_windows.cpp
changeset 7410 f5b282e7a7a6
parent 7405 e6fc8d3926f8
child 7448 11b630d174d5
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Thu Dec 02 20:01:47 2010 +0100
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Thu Dec 02 05:45:54 2010 -0800
@@ -1708,7 +1708,37 @@
     return;
   }
 
+  buf[0] = '\0';
+  if (strcmp(Arguments::sun_java_launcher(), "gamma") == 0) {
+     // Support for the gamma launcher. Check for an
+     // ALT_JAVA_HOME or JAVA_HOME environment variable
+     // and fix up the path so it looks like
+     // libjvm.so is installed there (append a fake suffix
+     // hotspot/libjvm.so).
+     char* java_home_var = ::getenv("ALT_JAVA_HOME");
+     if (java_home_var == NULL) {
+        java_home_var = ::getenv("JAVA_HOME");
+     }
+     if (java_home_var != NULL && java_home_var[0] != 0) {
+
+        strncpy(buf, java_home_var, buflen);
+
+        // determine if this is a legacy image or modules image
+        // modules image doesn't have "jre" subdirectory
+        size_t len = strlen(buf);
+        char* jrebin_p = buf + len;
+        jio_snprintf(jrebin_p, buflen-len, "\\jre\\bin\\");
+        if (0 != _access(buf, 0)) {
+          jio_snprintf(jrebin_p, buflen-len, "\\bin\\");
+        }
+        len = strlen(buf);
+        jio_snprintf(buf + len, buflen-len, "hotspot\\jvm.dll");
+     }
+  }
+
+  if(buf[0] == '\0') {
   GetModuleFileName(vm_lib_handle, buf, buflen);
+  }
   strcpy(saved_jvm_path, buf);
 }