Backend Development 3 min read

How to Modify Class Files Inside a JAR Using JD-GUI and Eclipse

This guide explains step‑by‑step how to decompile a JAR with JD‑GUI, edit the extracted Java source in Eclipse, recompile the class, replace it in the original JAR, and rebuild the package, providing a practical method for updating embedded class files.

360 Quality & Efficiency
360 Quality & Efficiency
360 Quality & Efficiency
How to Modify Class Files Inside a JAR Using JD-GUI and Eclipse

First, install JD‑GUI with brew cask install jd-gui . Open the target JAR (e.g., sdklibs.jar ) in JD‑GUI, locate the class you want to change (such as CodeConfig.class ), and save it as a Java source file.

Create a new Java project in Eclipse (or any IDE) and import the saved Java file, ensuring the package structure matches the original decompiled file; otherwise compilation errors will occur.

Modify the desired fields in the Java source (for example, change the CLOUD_SERVER_URL constant), then compile the project to generate a new .class file.

Verify the compiled class by opening it with JD‑GUI to confirm the changes took effect.

Extract the original JAR with tar -zxvf sdklibs.jar . Inside the extracted directory, navigate to the com folder, delete the old class file, and copy the newly compiled .class file into the same location.

Re‑package the JAR, preserving the original directory layout, using the command: jar cfm Holmes.jar META-INF/MANIFEST.MF ./

The resulting Holmes.jar is the updated JAR containing the modified class.

backendJavadecompilationJarEclipseJD-GUI
360 Quality & Efficiency
Written by

360 Quality & Efficiency

360 Quality & Efficiency focuses on seamlessly integrating quality and efficiency in R&D, sharing 360’s internal best practices with industry peers to foster collaboration among Chinese enterprises and drive greater efficiency value.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.