Building jar targeting multiple Java versions, including 9

Oliver Gondža ogondza at
Fri Aug 26 12:21:57 UTC 2016

On 2016-08-26 12:02, Alan Bateman wrote:

> In your mail then the class is "MyClass", I'm guessing this isn't really
> your actual class name.


> On the attach API then the supported/documented API is
> It's never been documented to make direct use of
> types in Are you casting the VirtualMachine to a
> HotSpotVirtualMachine and hacking into implementation?

I have implemented my own JMX connector[1], that do need to cast to 
HotSpotVirtualMachine in order to load the agent into target process 
using jcmd. If there ware a portable way to initiate JXM connection 
using socket or pid that would work across different java vendors and 
versions I would love to throw that all away but I have not found any. I 
intend to elaborate further and report back if this use-case can be 
covered by exposed modules or not.

> It might be best
> to explain what you are doing. You can of temporarily break
> encapsulation to allow the above to compile/run with `--add-exports
> jdk.attach/<target>", where <target> is your module
> name or ALL-UNNAMED if your library is on the class path.

Good to know that, thanks!


More information about the jigsaw-dev mailing list