agent

Dynamically load a Java Agent or acquire java.lang.instrument.Instrumentation via SPI

  • Load a Java Agent - dynamically, without prerequisite JAR file or JVM arguments
  • Get hold of an Instrumentation instance with SPI (using only this module as a runtime dependency)

For use in JUnit tests, please see the other module instrumental.agent.junit which already has JUnit 4 Rules and JUnit 5 Extensions.


Dependency Graph

Module Dependency

Examples

Instrumentation via SPI
	Instrumentation instrumentation = ServiceLoader.load(Instrumentation.class)
			.iterator().next();
Dynamically Load an Agent Class
	String agentArguments = "arbitrary.arguments=go.here";
	Path stubJar = DynamicAgent.loadAgent(StubAgent.class, agentArguments);


Back to top

Version: 0.1.0. Last Published: 2018-10-08.

Earcam Maven Skin.