How to Edit a .class File

Learn how to edit compiled Java .class files — decompile to source, modify the Java code, recompile, and replace the class in the JAR.

Step 1: View the Class File First

Step 2: Decompile to Java Source

Step 3: Edit the Java Source

Step 4: Recompile

Step 5: Replace the Class in the JAR

If the JAR Is Signed

Bytecode Editing (Without Decompiling)

Summary