Accessing Attach API?

Alan Bateman Alan.Bateman at oracle.com
Wed Apr 13 09:53:41 UTC 2016



On 13/04/2016 10:26, Aleksey Shipilev wrote:
> :
> Wait, I confused myself with multiple JDK builds here. This actually
> works in JDK 9b113:
>
> Class<?> vmClass = ClassLoader.getSystemClassLoader()
>                        .loadClass("com.sun.tools.attach.VirtualMachine");
>
> Therefore, we are fine at the moment. Is this behavior to stay?
>
The make file you found is the static configuration to map modules to 
the boot or platform class loaders. All other modules in the runtime 
image or on the application module path will be defined to the 
application class loader. In this case the module is named jdk.attach, 
you can see what it exports with this command:

$ java -listmods:jdk.attach

So no changes for existing code.  If you ever get to build JOL as a 
module then you will express the dependency with `requires jdk.attach`.

-Alan


More information about the jigsaw-dev mailing list