diff --git a/platform/platform-impl/src/com/intellij/util/JdkBundle.java b/platform/platform-impl/src/com/intellij/util/JdkBundle.java index b0a8e27611b2..da2981831826 100644 --- a/platform/platform-impl/src/com/intellij/util/JdkBundle.java +++ b/platform/platform-impl/src/com/intellij/util/JdkBundle.java @@ -204,8 +204,11 @@ public class JdkBundle { private static Pair, Pair> getJDKNameArchVersionAndUpdate(File jvm, String homeSubPath) { GeneralCommandLine commandLine = new GeneralCommandLine().withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.NONE); - commandLine.setExePath(new File(jvm, homeSubPath + File.separator + "jre" + - File.separator + "bin" + File.separator + "java").getAbsolutePath()); + File jvmPath = new File(jvm, homeSubPath + File.separator + "jre" + File.separator + "bin" + File.separator + "java"); + if (!jvmPath.exists()) { + jvmPath = new File(jvm, homeSubPath + File.separator + "bin" + File.separator + "java"); + } + commandLine.setExePath(jvmPath.getAbsolutePath()); commandLine.addParameter("-version"); String displayVersion; diff --git a/platform/platform-tests/testSrc/com/intellij/util/JdkBundleTest.java b/platform/platform-tests/testSrc/com/intellij/util/JdkBundleTest.java index 71508e93f09d..f86bafaeaeee 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/JdkBundleTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/JdkBundleTest.java @@ -113,10 +113,7 @@ public class JdkBundleTest { } } - @Test - public void testCreateBundle() throws Exception { - File homeJDK = new File(System.getProperty("java.home")).getParentFile(); - + public void doTestCreateBundle(File homeJDK) throws Exception { if (!new File(homeJDK, "lib/tools.jar").exists()) return; // Skip pure jre File bootJDK = SystemInfo.isMac ? homeJDK.getParentFile().getParentFile() : homeJDK; @@ -141,6 +138,15 @@ public class JdkBundleTest { assertTrue(evalVerStr + " is not the same with " + verStr, verStr.contains(evalVerStr)); } + @Test + public void testCreateBundle() throws Exception { + File home = new File(System.getProperty("java.home")); + + doTestCreateBundle(home); + + doTestCreateBundle(home.getParentFile()); + } + @Test public void testCreateBoot() throws Exception { File homeJDK = new File(System.getProperty("java.home")).getParentFile();