Referring to a different --system

Jayaprakash Artanareeswaran jay.a at
Fri Mar 10 06:09:47 UTC 2017


I remember there was an open issue about not being able to use a different JDK 9 (different than the current one) for class lookup. I raised this question some time back and the following solution was suggested:


At that point this solution only worked when the compiler was from a JDK 8 and not across different versions of JDK 9. This continues to be the case even today with Eclipse.

For convenience, the code proposed was this:

URL url = Paths.get(jdkHome, "jrt-fs.jar").toUri().toURL();
          URLClassLoader loader = new URLClassLoader(new URL[] { url });
          FileSystem fs = FileSystems.newFileSystem(URI.create("jrt:/"),
Collections.emptyMap(), loader);

Even today when I run the compiler with ea+159 and trying load JRT from ea+153, I can clearly see that the JrtFileSystem returned is still pointing to ea+159.

But I also noticed Javac is able to refer to different JDK 9 without any issue with --system., which makes me wonder if we should adjust our code in some way too.


More information about the jigsaw-dev mailing list