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


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

Back to top

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

Earcam Maven Skin.