I need to connect to JMX agent programmatically using Attach API (loading agent at runtime if necessary) as shown in example here. This worked fine in Java 8 but doesn't work in Java 9 since there is no management-agent.jar in the lib folder anymore:
String agent = vm.getSystemProperties().getProperty("java.home") +
File.separator + "lib" + File.separator + "management-agent.jar";
Could you please advice what is the right way to do that in Java 9?
Thanks in advance, Vadim
Yes, management-agent.jar has been removed (see release note). If you looking to start the management agent then look at the new startManagementAgent and startLocalManagementAgent methods in com.sun.tools.attach.VirtualMachine.
The "Setting Up Monitoring and Management Programmatically" section in the JDK 9 docs needs to be updated.