Search code examples
javajvmagent

Do Java agents affect the JVM classpath?


Do agents (-javaagent:agent.jar) affect the classpath of the JVM they are attached to?


Solution

  • Agent classes are loaded by the system class loader.

    Agents may also append other JARs to bootstrap classpath or system classpath by calling Instrumentation.appendToBootstrapClassLoaderSearch or Instrumentation.appendToSystemClassLoaderSearch respectively.