Namaste,
I used jd-gui from santoku linux where they pre-packaged it to reverse engineer mobile apps and other forensic purpose.
I tried to open jar contents and tried to modify the class file content and the jd-gui it not allowing me to edit the files.
Is it how jd-gui works or do I need to make any changes in the jd-gui.
Can you please suggest any alternative where I could modify class files and recompile back to apk (android package) files ?
Thanks,
Kiran.
Sometimes I need to know what’s inside to figure out a best solution, like modifying a Java .class file in a .jar file. 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 srcdir
Modify a java file, then compile it to .class file.
cd srcdir vi com/.../A.java cp some_folder/original.jar ./ javac -cp "original.jar" com/.../A.java
The last command will generate a file named A.class in the same folder as A.java
Use luyten to check if the file A.class is modified.
jar -uf original.jar com/.../A.class mv original.jar modified.jar
This will generate a modified.jar. Use luyten to check again if it’s modified.
Note: If A.java depends other external jars other than original.jar, Add them to classpath by
javac -cp "original.jar;lib/*" com/.../A.java
It’s important to use lib/* rather than lib/*.jar because the later will not work.
- Overview
- Main Features
The “Java Decompiler project” aims to develop tools in order to decompile and analyze Java 5 “byte code” and the later versions.
JD-GUI is a standalone graphical utility that displays Java source codes of “.class” files. You can browse the reconstructed source code with the JD-GUI for instant access to methods and fields.
JD-Eclipse is a plug-in for the Eclipse platform. It allows you to display all the Java sources during your debugging process, even if you do not have them all.
JD-Core is a library that reconstructs Java source code from one or more “.class” files. JD-Core may be used to recover lost source code and explore the source of Java runtime libraries. New features of Java 5, such as annotations, generics or type “enum”, are supported. JD-GUI and JD-Eclipse include JD-Core library.
JD-Core, JD-GUI & JD-Eclipse are open source projects released under the GPLv3 License.
- JD-Core and JD-GUI are written in Java.
- JD-Core works with most current compilers including the following:
- JDK 1.1.8, JDK 1.3.1, JDK 1.4.2, JDK 1.5.0, JDK 1.6.0, JDK 1.7.0, JDK 1.8.0, JDK 9.0.1, JDK 10.0.2
- jrockit90_150_06
- jikes-1.22
- harmony-jdk-r533500
- Eclipse Java Compiler v_677_R32x, 3.2.1 release
- JD-GUI supports Drag and Drop.
- JD-GUI supports CLASS, JAR, WAR, EAR, AAR, KAR, JMOD & ZIP files.
- JD-GUI displays color coded Java source code.
- JD-GUI allows you to browse the CLASS files and Java modules hierarchy.
- JD-GUI lets you drag and drop LOG files, decompile CLASS files, and display the line of code that appears in Java stack traces.
- Overview
- Download
JD-GUI is a standalone graphical utility that displays Java source codes of “.class” files. You can browse the reconstructed source code with the JD-GUI for instant access to methods and fields.
Releases
Size : 3.09 MB
Size : 1.41 MB
Size : 1.28 MB
Size : 1.52 MB
Size : 1.30 MB
Release details & Old releases
Issues
Donations
Did JD-GUI help you to solve a critical situation? Do you use JD-Eclipse daily? What about making a donation?
- Overview
- Download
JD-Eclipse is a plug-in for the Eclipse platform. It allows you to display all the Java sources during your debugging process, even if you do not have them all.
Release
Size : 594 KB
Installation
- Download JD-Eclipse ZIP file,
- Launch Eclipse,
- Click on "Help > Install New Software...",
- Drag and drop ZIP file on dialog windows,
- Check "Java Decompiler Eclipse Plug-in",
- Click on "Next" and "Finish" buttons,
- A warning dialog windows appear because "org.jd.ide.eclipse.plugin_x.y.z.jar" is not signed. Click on "Install anyway" button.
Release details & Old releases
Issues
Donations
Did JD-GUI help you to solve a critical situation? Do you use JD-Eclipse daily? What about making a donation?