Starting with JDK 1.5, the javaagent feature has been around which provides for a hook to get access to the classes as they are loaded and consequently do instrumentation of the class to serve your purpose. This along with Javassist will allow you to achieve some useful tasks like enabling specific debugging etc. Below are some useful links for the same http://www.csg.ci.i.u-tokyo.ac.jp/~chiba/javassist/tutorial/tutorial.html http://blog.javabenchmark.org/2013/05/java-instrumentation-tutorial.html https://today.java.net/article/2008/04/22/add-logging-class-load-time-java-instrumentation I used to face issues related to the agent class not been able to find javassist related classes. To tackle this you can add an index file to the agent jar like below. jar -i agent.jar lib\javassist.jar and ensure that during deployment the javassist.jar file is in the lib folder which itselfs exists in the same directory as the agent jar. The insertBefore and insertAfter method...