From 1104be609f2847387da2da16c4dd1be624f1c858 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 15 Feb 2018 08:31:49 +0100 Subject: Find Java 9 with the new registry keys on Windows See section "Windows Registry Key Changes". Reviewed-on: https://gerrit.libreoffice.org/49792 Tested-by: Jenkins Reviewed-by: Stephan Bergmann (cherry picked from commit cc8e8215c8d7583f36feca20f0a1235edc05a6d7) Conflicts: jvmfwk/plugins/sunmajor/pluginlib/util.cxx Change-Id: Ic30ce430663cc1608c6268fa937142f73c55f138 Reviewed-on: https://gerrit.libreoffice.org/49822 Reviewed-by: Andras Timar Tested-by: Andras Timar --- jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 72 ++++++++++++++++++------------ 1 file changed, 43 insertions(+), 29 deletions(-) diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx index d1a0088f1510..062abf494f0a 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx @@ -577,35 +577,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 - typedef std::vector::iterator ItHome; - for(ItHome it_home= vecJavaHome.begin(); it_home != vecJavaHome.end(); - ++it_home) - { - getAndAddJREInfoByPath(*it_home, allInfos, addedInfos); - } - } - - vecJavaHome.clear(); - if(getJREInfoFromRegistry(vecJavaHome)) - { - typedef std::vector::iterator ItHome; - for(ItHome it_home= vecJavaHome.begin(); it_home != vecJavaHome.end(); - ++it_home) - { - getAndAddJREInfoByPath(*it_home, allInfos, addedInfos); - } - } -} - bool getJavaInfoFromRegistry(const wchar_t* szRegKey, vector& vecJavaHome) @@ -687,6 +658,49 @@ 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 + typedef std::vector::iterator ItHome; + for(ItHome it_home= vecJavaHome.begin(); it_home != vecJavaHome.end(); + ++it_home) + { + getAndAddJREInfoByPath(*it_home, allInfos, addedInfos); + } + } + + vecJavaHome.clear(); + if(getJREInfoFromRegistry(vecJavaHome)) + { + typedef std::vector::iterator ItHome; + for(ItHome it_home= vecJavaHome.begin(); it_home != vecJavaHome.end(); + ++it_home) + { + getAndAddJREInfoByPath(*it_home, 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) -- cgit