From cc8e8215c8d7583f36feca20f0a1235edc05a6d7 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 15 Feb 2018 08:31:49 +0100 Subject: [PATCH] Find Java 9 with the new registry keys on Windows See section "Windows Registry Key Changes". Change-Id: Ic30ce430663cc1608c6268fa937142f73c55f138 Reviewed-on: https://gerrit.libreoffice.org/49792 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 64 +++++++++++++--------- 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx index fb6ec2ba6eb4..187a2789b4cc 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx @@ -569,31 +569,6 @@ bool decodeOutput(const OString& s, OUString* out) #if defined(_WIN32) -void addJavaInfoFromWinReg( - std::vector > & allInfos, - std::vector > & addedInfos) -{ - // Get Java s from registry - std::vector vecJavaHome; - if(getSDKInfoFromRegistry(vecJavaHome)) - { - // create impl objects - for (auto const& javaHome : vecJavaHome) - { - getAndAddJREInfoByPath(javaHome, allInfos, addedInfos); - } - } - - vecJavaHome.clear(); - if(getJREInfoFromRegistry(vecJavaHome)) - { - for (auto const& javaHome : vecJavaHome) - { - getAndAddJREInfoByPath(javaHome, allInfos, addedInfos); - } - } -} - bool getJavaInfoFromRegistry(const wchar_t* szRegKey, vector& vecJavaHome) @@ -678,6 +653,45 @@ bool getJREInfoFromRegistry(vector& vecJavaHome) return getJavaInfoFromRegistry(HKEY_SUN_JRE, vecJavaHome); } +void addJavaInfoFromWinReg( + std::vector > & allInfos, + std::vector > & addedInfos) +{ + // Get Java s from registry + std::vector vecJavaHome; + if(getSDKInfoFromRegistry(vecJavaHome)) + { + // create impl objects + for (auto const& javaHome : vecJavaHome) + { + getAndAddJREInfoByPath(javaHome, allInfos, addedInfos); + } + } + + vecJavaHome.clear(); + if(getJREInfoFromRegistry(vecJavaHome)) + { + for (auto const& javaHome : vecJavaHome) + { + getAndAddJREInfoByPath(javaHome, allInfos, addedInfos); + } + } + + vecJavaHome.clear(); + if (getJavaInfoFromRegistry(L"Software\\JavaSoft\\JDK", vecJavaHome)) { + for (auto const & javaHome: vecJavaHome) { + getAndAddJREInfoByPath(javaHome, allInfos, addedInfos); + } + } + + vecJavaHome.clear(); + if (getJavaInfoFromRegistry(L"Software\\JavaSoft\\JRE", vecJavaHome)) { + for (auto const & javaHome: vecJavaHome) { + getAndAddJREInfoByPath(javaHome, allInfos, addedInfos); + } + } +} + #endif // WNT void bubbleSortVersion(vector >& vec)