1 # The JMC Agent
   2 The JMC agent is an agent currently under development to add JFR instrumentation declaratively to a running program. The agent can, for example, be used to add flight recorder events to third party code for which the source is not available.
   4 To build the agent you will need a JDK 7 or later. To run the agent, a JDK 7 or later will be needed as well.
   6 ## Building the agent
   7 To build the agent, simply use maven in the agent folder. Since the agent is not ready for prime time yet, it is not built with the rest of the core libraries.
   9 ```bash
  10 mvn clean package
  11 ```
  13 ## Running the agent
  14 The agent can be tried out using the included example program.
  16 Here is an example for running the example program with Oracle JDK 7 to Oracle JDK 10:

  18 ```bash
  19 java -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -javaagent:target/org.openjdk.jmc.agent-1.0.0-SNAPSHOT.jar=target/test-classes/org/openjdk/jmc/agent/test/jfrprobes_template.xml -cp target/org.openjdk.jmc.agent-1.0.0-SNAPSHOT.jar:target/test-classes/ org.openjdk.jmc.agent.test.InstrumentMe
  20 ```
  22 Here is an example for running the example program with OpenJDK 11+:


  24 ```bash

  25 java --add-opens java.base/jdk.internal.misc=ALL-UNNAMED -XX:+FlightRecorder -javaagent:target/org.openjdk.jmc.agent-1.0.0-SNAPSHOT.jar=target/test-classes/org/openjdk/jmc/agent/test/jfrprobes_template.xml -cp target/org.openjdk.jmc.agent-1.0.0-SNAPSHOT.jar:target/test-classes/ org.openjdk.jmc.agent.test.InstrumentMe

  26 ```


  28 ## Known Issues
  29 * The full converter support is still to be merged into the open source repo
  30 * Support for emitting an event only on exception has yet to be implemented
  31 * Support for reflective access to fields has yet to be implemented
  32 * Support for emitting event even though an exception was raised in a called method (try-finally)
  33 * XML probe definition validation (schema)
  34 * Support for redefinitions and controlling the agent over JMX is not yet completed
--- EOF ---