java – How to change already compiled .class file without decompile?

java – How to change already compiled .class file without decompile?

You can follow these steps to modify your java class:

  1. Decompile the .class file as you have done and save it as .java
  2. Create a project in Eclipse with that java file, the original JAR
    as library, and all its dependencies
  3. Change the .java and compile
  4. Get the modified .class file and put it again inside the original
    JAR.

Use a bytecode editor, like:

http://set.ee/jbe/

Be careful because you need a very good knowledge of the Java bytecode.

You can also change the class at runtime with bytecode weaving (like AspectJ).

java – How to change already compiled .class file without decompile?

I added some codes and save .class file.

What you see in JD EClipse Decompiler is decompiled representation of byte code in the .class file. Even though you change the text it wont affect the byte code.

Leave a Reply

Your email address will not be published.