@@ -27,17 +27,22 @@ object ClasspathFromClassloader {
27
27
classpathBuff ++=
28
28
cl.getURLs.iterator.map(url => Paths .get(url.toURI).toAbsolutePath.toString)
29
29
case _ =>
30
- // HACK: We can't just collect the classpath from arbitrary parent
31
- // classloaders since the current classloader might intentionally
32
- // filter loading classes from its parent (for example
33
- // BootFilteredLoader in the sbt launcher does this and we really
34
- // don't want to include the scala-library that sbt depends on
35
- // here), but we do need to look at the parent of the REPL
36
- // classloader, so we special case it. We can't do this using a type
37
- // test since the REPL classloader class itself is normally loaded
38
- // with a different classloader.
39
- if (cl.getClass.getName == classOf [ AbstractFileClassLoader ].getName)
30
+ if cl.getClass.getName == classOf [ AbstractFileClassLoader ].getName then
31
+ // HACK: We can't just collect the classpath from arbitrary parent
32
+ // classloaders since the current classloader might intentionally
33
+ // filter loading classes from its parent (for example
34
+ // BootFilteredLoader in the sbt launcher does this and we really
35
+ // don't want to include the scala-library that sbt depends on
36
+ // here), but we do need to look at the parent of the REPL
37
+ // classloader, so we special case it. We can't do this using a type
38
+ // test since the REPL classloader class itself is normally loaded
39
+ // with a different classloader.
40
40
collectClassLoaderPaths(cl.getParent)
41
+ else if cl eq ClassLoader .getSystemClassLoader then
42
+ // HACK: For Java 9+, if the classloader is an AppClassLoader then use the classpath from the system
43
+ // property `java.class.path`.
44
+ // See: https://java-browser.yawk.at/java/10/java.base/jdk/internal/loader/ClassLoaders.java#163
45
+ classpathBuff += System .getProperty(" java.class.path" )
41
46
}
42
47
}
43
48
}
0 commit comments