--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/PlatformClassPath.java Wed Jul 05 20:38:50 2017 +0200
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/PlatformClassPath.java Thu Jun 25 18:00:52 2015 +0200
@@ -97,23 +97,32 @@
}
static class ImageHelper {
+ private static boolean isJrtAvailable() {
+ try {
+ FileSystems.getFileSystem(URI.create("jrt:/"));
+ return true;
+ } catch (ProviderNotFoundException | FileSystemNotFoundException e) {
+ return false;
+ }
+ }
+
static ImageHelper getInstance(Path mpath) throws IOException {
if (mpath != null) {
return new ImageHelper(mpath);
}
- Path home = Paths.get(System.getProperty("java.home"));
- Path mlib = home.resolve("lib").resolve("modules");
- if (Files.isDirectory(mlib)) {
- // jimage
+
+ if (isJrtAvailable()) {
+ // jrt file system
FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
- return new ImageHelper(fs, fs.getPath("/"));
+ return new ImageHelper(fs, fs.getPath("/modules"));
} else {
// exploded modules
- mlib = home.resolve("modules");
- if (!Files.isDirectory(mlib)) {
- throw new InternalError(home + " not a modular image");
+ String home = System.getProperty("java.home");
+ Path exploded = Paths.get(home, "modules");
+ if (!Files.isDirectory(exploded)) {
+ throw new InternalError(home + " not a modular image");
}
- return new ImageHelper(mlib);
+ return new ImageHelper(exploded);
}
}