Sometimes I need to know what’s inside to figure out a best solution, like modifying a Java
.class file in a
After searching google and stack overflow for a while, I found this question is little cared, and almost all information is not complete.
So I wrap them up and make the whole process runnable.
Use luyten (or JD GUI if you don’t care its bugs) to decompile the jar, and save all files to folder
Modify a java file, then compile it to
1 2 3 4
The last command will generate a file named
A.class in the same folder as
Use luyten to check if the file
A.class is modified.
This will generate a
modified.jar. Use luyten to check again if it’s modified.
A.java depends other external jars other than
original.jar, Add them to classpath by
It’s important to use
lib/* rather than
lib/*.jar because the later will not work.