Reading bootstrap class bytecode from Java 7

Peter Levart peter.levart at
Tue Dec 6 14:49:58 UTC 2016


On 12/05/2016 08:42 AM, Alan Bateman wrote:
> On 05/12/2016 07:21, Remi Forax wrote:
>> Hi,
>> Object.class.getClassLoader().getResourceAsStream(Object.class.getName().replace('.', 
>> '/') + ".class")
>> should work across all jdks.
> This should work as before (ignoring the issue that 
> Object.class.getClassLoader() will return null :-))
> However, as I read it, the original question involves a tool running 
> on JDK 7 trying to access the .class files in a JDK 9 image. There 
> isn't any supported way to do that, the tool needs to be on a minimum 
> of JDK 8 as the jrtfs provider is compiled to 8.
> -Alan

Has anyone tried to translate the jrt-fs.jar using the following tool?

java.nio.file API was introduced in JDK 7 so in theory this could be 
possible. With a caveat that even if this appears to work, the resulting 
converted jrt-fs.jar will only be suitable for accessing classes in the 
image of JDK 9. Until JDK 10 ships, the image format might change and a 
new version of jrt-fs.jar will be needed...

Regards, Peter

More information about the jigsaw-dev mailing list