How can I do that

I have different Java applications running on my system and you want tool classes from one of these applications

While trying to do this with a dynamically loadable Java agent, I found that we can attach it to an instance jvm

that requires an vm

id

instance jvm

, when I put pid

already running a Java application by searching from the Windows Task Manager, the container agent does not attach to this process and an error occurs.

By doing this with a ManagementFactory.getRuntimeMXBean()

, the returned process id()

is the instance loading agent.jar

. kindly suggest how to access vmid

another instancejvm

+3


source to share


1 answer


You can use scripts to execute JPS command and retrieve information about running VM instances.



Also the jps command uses the MonitoredHost API, in which the activeVms () method.

+1


source







All Articles