From 9af3c3f94077a482f26ef479a4ecb570064415af Mon Sep 17 00:00:00 2001 From: Alexey Semenyuk Date: Mon, 17 Oct 2016 11:04:49 -0700 Subject: [PATCH] 8168093: Need a way for the launcher to query the JRE location using Windows registry Reviewed-by: erikj, ksrini --- jdk/src/java.base/windows/native/libjli/java_md.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/jdk/src/java.base/windows/native/libjli/java_md.c b/jdk/src/java.base/windows/native/libjli/java_md.c index 3d29357542b..1db3c408740 100644 --- a/jdk/src/java.base/windows/native/libjli/java_md.c +++ b/jdk/src/java.base/windows/native/libjli/java_md.c @@ -48,6 +48,10 @@ static jboolean GetJVMPath(const char *jrepath, const char *jvmtype, 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 @@ GetJREPath(char *path, jint pathsize) } } +#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; }