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:
- Decompile the .class file as you have done and save it as .java
- Create a project in Eclipse with that java file, the original JAR
as library, and all its dependencies - Change the .java and compile
- Get the modified .class file and put it again inside the original
JAR.
Use a bytecode editor, like:
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.