Search code examples
javajavaagents

How to import a class using javaagent


I am trying to import the Serializable interface into a java executable using javaagent. How is this possible?


Solution

  • I found a way to do it. In the transform(ClassLoader loader, String className, Class clazz, java.security.ProtectionDomain domain, byte[] bytes) method, just add loader.loadClass("java.io.Serializable").