IDEA-168924 JDK switcher does not show bundled jdk

Handled new bundled jdk structure
This commit is contained in:
Alexey Ushakov
2017-03-01 22:51:02 +03:00
parent b85b5b8725
commit 0207ef1320
2 changed files with 15 additions and 6 deletions
@@ -204,8 +204,11 @@ public class JdkBundle {
private static Pair<Pair<String, Boolean>, Pair<Version, Integer>> 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;
@@ -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();