A Java agent allows for the instrumentation of a Java application by using another Java program that is specified on the command line.
All Java classes concerned with instrumentation are collected in the java.lang.instrument
package. The package description defines the layout of a Java agent as follows:
An agent is deployed as a JAR file. An attribute in the JAR file manifest specifies the agent class which will be loaded to start the agent. For implementations that support a command-line interface, an agent is started by specifying an option on the command-line. Implementations may also support a mechanism to start agents some time after the VM has started. For example, an implementation may provide a mechanism that allows a tool to attach to a running application, and initiate the loading of the tool's agent into the running application. The details as to how the load is initiated, is implementation dependent.