We will use jrunscript and internal hotspot API to access and export the classfile data. To do that we will use 2 jrunscript processes, a "debuggee" process and a "debugger" jrunscript process. The debugger process will attach to and inspect the debuggee process (internal) via hotspot API. For this example we use the "latest" Java 9 build b41 on OSX.
Motivation for this example was given by the fact that the latest JDK 9 release b41 doesn't ship an rt.jar anymore.
The content from rt.jar was now moved to a new platform specific format with the extension .jimage
in the JDK_HOME/lib/modules
.
You can find more information about the new packaging in Java 9 in Mark Reinholds blogpost: http://mreinhold.org/blog/jigsaw-modular-images