Discussion:
Access to jdk.hotspot.agent classes in Java 9?
(too old to reply)
Daniel D. Daugherty
2018-11-20 16:48:55 UTC
Permalink
Adding serviceability-***@... since this is the Serviceability Agent...

Dan
Hi, I'm writing some code that makes use of the SA classes under
sun.jvm.hotspot. This compiles and runs fine under Java 8 provided I
include sa-jdi.jar but I've just discovered that these are now classified
as JDK internal API in Java 9. There is no alternative so what should I do?
Thanks,
David
David Holmes
2018-11-20 20:47:00 UTC
Permalink
Hi David,

The sun.jvm.hotspot classes have always been a JDK internal API. What
has changed in Java 9 is that the Java Platform Module System now
enforces that restriction. To use these classes you must explicitly
export them when running (and compiling?) your application e.g.

--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED

You may need to do that for each package you need to access.

HTH.

David Holmes
Dan
Hi, I'm writing some code that makes use of the SA classes under
sun.jvm.hotspot. This compiles and runs fine under Java 8 provided I
include sa-jdi.jar but I've just discovered that these are now classified
as JDK internal API in Java 9. There is no alternative so what should I do?
Thanks,
David
David Griffiths
2018-11-21 10:22:40 UTC
Permalink
Ok, thanks, that worked and I can now use them again.

Cheers,

David
Post by David Holmes
Hi David,
The sun.jvm.hotspot classes have always been a JDK internal API. What
has changed in Java 9 is that the Java Platform Module System now
enforces that restriction. To use these classes you must explicitly
export them when running (and compiling?) your application e.g.
--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED
You may need to do that for each package you need to access.
HTH.
David Holmes
Dan
Hi, I'm writing some code that makes use of the SA classes under
sun.jvm.hotspot. This compiles and runs fine under Java 8 provided I
include sa-jdi.jar but I've just discovered that these are now
classified
as JDK internal API in Java 9. There is no alternative so what should I do?
Thanks,
David
Loading...