tags:

views:

37

answers:

1

The JVM Tool Interface(JVMTI) specification says that the JVMTI agents can be started in the VM during live phase but they havent mentioned how it can be done. Has anyone tried this before or got any hints on how to do it?

A: 

You can use method

 * @param   agent
 *          Path to the JAR file containing the agent.
 *
 * @param   options
 *          The options to provide to the agent's <code>agentmain</code>
 *          method (can be <code>null</code>).

com.sun.tools.attach.VirtualMachine.loadAgent(String agent, String options)

from ${java.home}/../lib/tools.jar

Sergey