8168093: Need a way for the launcher to query the JRE location using Windows registry.
authorasemenyuk
Mon, 17 Oct 2016 11:04:49 -0700
changeset 41558 750de2810ded
parent 41557 f3c879316eab
child 41559 5b33f33df1fb
8168093: Need a way for the launcher to query the JRE location using Windows registry. Reviewed-by: erikj, ksrini Contributed-by: alexey.semenyuk@oracle.com
jdk/src/java.base/windows/native/libjli/java_md.c
--- a/jdk/src/java.base/windows/native/libjli/java_md.c	Tue Oct 18 09:20:10 2016 -0400
+++ b/jdk/src/java.base/windows/native/libjli/java_md.c	Mon Oct 17 11:04:49 2016 -0700
@@ -48,6 +48,10 @@
                            char *jvmpath, jint jvmpathsize);
 static jboolean GetJREPath(char *path, jint pathsize);
 
+#ifdef USE_REGISTRY_LOOKUP
+jboolean GetPublicJREHome(char *buf, jint bufsize);
+#endif
+
 /* We supports warmup for UI stack that is performed in parallel
  * to VM initialization.
  * This helps to improve startup of UI application as warmup phase
@@ -346,6 +350,14 @@
         }
     }
 
+#ifdef USE_REGISTRY_LOOKUP
+    /* Lookup public JRE using Windows registry. */
+    if (GetPublicJREHome(path, pathsize)) {
+        JLI_TraceLauncher("JRE path is %s\n", path);
+        return JNI_TRUE;
+    }
+#endif
+
     JLI_ReportErrorMessage(JRE_ERROR8 JAVA_DLL);
     return JNI_FALSE;
 }