On 10/09/2015 06:52, Sundararajan Athijegannathan wrote:
:

ClassLoader.getResource for a .class resource is checked to detect if it runs on jdk9. This returns a "jrt:" URL in jdk9 EA build - but, returns null with jigsaw build. Also, RuntimeMXBean.isBootClassPathSupported() returns false.
So, isSupportedJDK will be false.

Better solution would be to check if "jrt" nio file system is available & use the same to check and/or read .class files of JDK classes.
That will work but it might be better to look at java.lang.reflect.Module#getResourceAsStream as this will work for resources in both named and unnamed modules (for unnamed modules then it works like ClassLoader#getResourceAsStream). The summary on this is that the ClassLoader#getResourceXXX methods will locate resources on the class path as before, it's just that they don't locate resources in named modules.

-Alan

Reply via email to