Connecting to the JMX Agent Programmatically in Java 9
Asked Answered
S

1

5

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

Stockstill answered 27/9, 2017 at 9:38 Comment(1)
the document you linked needs to be updates it seems, the jar is no more a part of libSaturated
L
6

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.

Lymanlymann answered 27/9, 2017 at 10:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.