 <p>You are looking for software that allows you to do bytecode manipulation, there are several frameworks to achieve this, but the two most known currently are:</p> <ul> <li><a href="http://asm.ow2.org/" rel="nofollow">ASM</a></li> <li><a href="http://www.javassist.org" rel="nofollow">javassist</a></li> </ul> <p>When performing bytecode modifications at runtime in Java classes keep in mind the following:</p> <ul> <li><p>If you change a class's bytecode after a class has been loaded by a classloader, you'll have to find a way to reload it's class definition (either through classloading tricks, or using hotswap functionalities)</p></li> <li><p>If you change the classes interface (example add new methods or fields) you will be able only to reach them through reflection.</p></li> </ul>