Java agent

A Java agent is a Java program that is loaded by the Java runtime in a special way and can be used to interfere with the bytecode of the loaded classes, to alter them. They can be used to do the following:

  • List or log, and report the loaded classes during runtime as they are loaded
  • Modify the classes so that the methods will contain extra code to report runtime behavior
  • Support debuggers to alter the content of a class as the developer modifies the source code

This technology is used in, for example, the JRebel and XRebel products from

Although Java agents work in the deep details of Java, they are not magic. They are a bit complex and you need a deep understanding of Java, but anyone who can program ...

Get Java Projects - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.