Showing posts from December, 2010

Play with your byte-code using Javassist

I came to know about this nice tool named javassist which is a cool java byte code manipulation tool.It provides users with a very easy to use API to modify / create java classes in the Runtime. It provides some API to do that using a Java like syntax so that we can easily hack the byte code without knowing any thing in-depth about the byte code structure. In this blog post I'll explain you a simple example on how to use this tool.This will show how we can use javassist to change the byte code of a compiled class to change a method implementation in Runtime. Step 1 Download javassist library from Step 2 Create a new directory and copy javassist.jar to that directory. Step 3 Create Two java source file named and in that directry public class HelloWorld { public static void main(String[] args) { new HelloWorld().sayHello(); } public void sayHello(){