@@ -27,17 +27,21 @@ object ClasspathFromClassloader {
2727 classpathBuff ++=
2828 cl.getURLs.iterator.map(url => Paths .get(url.toURI).toAbsolutePath.toString)
2929 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.
4040 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+ classpathBuff += System .getProperty(" java.class.path" )
4145 }
4246 }
4347 }
0 commit comments