Bug 563769 - StandardVMType is confused by a JRE in a folder named jre
that is not actually nested in a folder that is a JDK
In getDefaultLibraryLocations, check that the computed location of
JRT_FS_JAR actually exists before adding it to the result locations.
Change-Id: I47d34a372a38f19449fe93bea596deda44cc3b0e
Signed-off-by: Ed Merks <ed.merks@gmail.com>
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMType.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMType.java
index c64fecb..2a9099f 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMType.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMType.java
@@ -480,14 +480,16 @@
IPath pathName = new Path(installLocation.getAbsolutePath()).append(LIB).append(JRT_FS_JAR);
// From Java 9 149 version, we see that jrt-fs.jar is moved to lib directory so we need to look at both places
File jrtfsJar = pathName.toFile();
- if (!jrtfsJar.exists()) {
+ boolean exists = jrtfsJar.exists();
+ if (!exists) {
pathName = new Path(installLocation.getAbsolutePath()).append(JRT_FS_JAR);
+ exists = pathName.toFile().exists();
}
- LibraryLocation libraryLocation = new LibraryLocation(pathName,
- sourceRootPath, getDefaultPackageRootPath(),
- getDefaultJavadocLocation(installLocation));
- allLibs.add(libraryLocation);
+ if (exists) {
+ LibraryLocation libraryLocation = new LibraryLocation(pathName, sourceRootPath, getDefaultPackageRootPath(), getDefaultJavadocLocation(installLocation));
+ allLibs.add(libraryLocation);
+ }
}
// next is the boot path libraries