Cavaj Java Decompiler is a graphical freeware utility that reconstructs java source code from CLASS files. You can decompile java applets, jar and zip files producing accurate java source code. Browse the reconstructed source code with the Class View for instant access to methods and fields.
Does anyone know of a free decompiler that can decompile an entire Jar file instead of a single class? I have a problem with sub classes like name$1.class name$2.class name.class
StoneHeartStoneHeart
closed as off-topic by Martijn Pieters♦Aug 4 '15 at 12:37
This question appears to be off-topic. The users who voted to close gave this specific reason:
- 'Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.' – Martijn Pieters
9 Answers
2009: JavaDecompiler can do a good job with a jar: since 0.2.5, All files, in JAR files, are displayed.
See also the question 'How do I “decompile” Java class files?'.
The JD-Eclipse doesn't seem to have changed since late 2009 though (see Changes).
So its integration with latest Eclipse (3.8, 4.2+) might be problematic.
So its integration with latest Eclipse (3.8, 4.2+) might be problematic.
JD-Core is actively maintained.
Both are the result of the fantastic work of (SO user) Emmanuel Dupuy.
2018: A more modern option, mentioned in the comments by David Kennedy Araujo:
Fernflower is the first actually working analytical decompiler for Java and probably for a high-level programming language in general.
See also How to decompile to java files intellij idea for a command working with recent IntelliJ IDEA.
VonCVonC
If you happen to have both a bash shell and jad:
I might be a tiny, tiny bit off with that, but it should work more or less as advertised. You should end up with
$JAR.tmp
containing your decompiled files.Chris RChris R
First of all, it's worth remembering that all Java archive files (
.jar
/.war
/etc...) are all basically just fancy.zip
files, with a few added manifests and metadata.Second, to tackle this problem I personally use several tools which handle this problem on all levels:
- Jad + Jadclipse while working in IDE for decompiling
.class
files - WinRAR, my favorite compression tool natively supports Java archives (again, see first paragraph).
- Beyond Compare, my favorite diff tool, when configured correctly can do on-the-fly comparisons between any archive file, including
jar
s. Well worth a try.
The advantage of all the aforementioned, is that I do not need to hold any other external tool which clutters my work environment. Everything I will ever need from one of those files can be handled inside my IDE or diffed with other files natively.
Yuval AdamYuval Adam
I have had reasonable success with a tool named (frustratingly) 'JD: Java Decompiler'.
I have found it better than most decompilers when dealing with classes compiled for Java 5 and higher. Unfortunately, it can still have some hiccups where JAD would normally succeed.
Adam PaynterAdam Paynter
cybertoastcybertoast
Insert the following into decompile.jar.sh
- chmod +x decomplie.jar.sh //executable
- ln -s ./decomplie.jar.s /usr/bin/dj
Ready to use, just type
dj your.jar
and you will get your.jar.src
folder with sources. Use -d
option for debug mode.merzodmerzod
A jar file is just a zip file with jar extension. You should be able to unzip(winzip) a jar just like a zip file.
CadooCadoo
yanchenkoyanchenko
Note: This solution only works for Mac and *nix users.
I also tried to find Jad with no luck. My quick solution was to download MacJad that contains jad. Once you downloaded it you can find jad in [where-you-downloaded-macjad]/MacJAD/Contents/Resources/jad.
Joel SJoel S
Not the answer you're looking for? Browse other questions tagged javajardecompiler or ask your own question.
votes
What program can I use to decompile a class file? Will I actually get Java code, or is it just JVM assembly code?
On Java performance questions on this site I often see responses from people who have 'decompiled' the Java class file to see how the compiler optimizes certain things.
KipKip
closed as off-topic by Jean-François Corbett, cimmanon, Paul Roub, Maroun, CRABOLOOct 25 '15 at 17:48
This question appears to be off-topic. The users who voted to close gave this specific reason:
- 'Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.' – Jean-François Corbett, cimmanon, Paul Roub, Maroun, CRABOLO
locked by Samuel Liew♦Jul 1 '18 at 23:10
This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.
Read more about locked posts here.
19 Answers
votes
Update February 2016:
www.javadecompilers.com lists JAD as being:
the most popular Java decompiler, but primarily of this age only. Written in C++, so very fast.
Outdated, unsupported and does not decompile correctly Java 5 and later
Outdated, unsupported and does not decompile correctly Java 5 and later
So your mileage may vary with recent jdk (7, 8).
The same site list other tools.
And javadecompiler, as noted by Salvador Valencia in the comments (Sept 2017), offers a SaaS where you upload the
.class
file to the cloud and it returns you the decompiled code. Original answer: Oct. 2008
- The final release of JSR 176, defining the major features of J2SE 5.0 (Java SE 5), has been published on September 30, 2004.
- The lastest Java version supported by JAD, the famous Java decompiler written by Mr. Pavel Kouznetsov, is JDK 1.3.
- Most of the Java decompilers downloadable today from the Internet, such as “DJ Java Decompiler” or “Cavaj Java Decompiler”, are powered by JAD: they can not display Java 5 sources.
Java Decompiler (Yet another Fast Java decompiler) has:
- Explicit support for decompiling and analyzing Java 5+ “.class” files.
- A nice GUI:
It works with compilers from JDK 1.1.8 up to JDK 1.7.0, and others (Jikes, JRockit, etc.).
It features an online live demo version that is actually fully functional! You can just drop a jar file on the page and see the decompiled source code without installing anything.
VonCVonC
votes
There are a few decompilers out there... A quick search yields:
- Procyon: open-source (Apache 2) and actively developed
- Krakatau: open-source (GPLv3) and actively developed
- CFR: open-source (MIT) and actively developed
And many more.
These produce Java code. Java comes with something that lets you see JVM byte code (javap).
billjamesdevbilljamesdev
votes
To see Java source code check some decompiler. Go search for jad.
If you want to see bytecodes, just use javap which comes with the JDK.
MarkoMarko
votes
I tried several, and Procyon seemed to work the best for me. It's under active development and supports many features of the latest versions of Java.
These are the others I tried:
- CFR
- Promising, but often failed method decompilation. I'll be keeping my eye on this one. Also actively developed with support for the latest Java features.
- Krakatau
- Takes a different approach in that it tries to output equivalent Java code instead of trying to reconstruct the original source, which has the potential of making it better for obfuscated code. From my testing it was roughly on par with Procyon, but still nice to have something different. I did have to use the
-skip
command-line flag so it wouldn't stop on errors. Actively developed, and interestingly enough it's written in Python.
- Takes a different approach in that it tries to output equivalent Java code instead of trying to reconstruct the original source, which has the potential of making it better for obfuscated code. From my testing it was roughly on par with Procyon, but still nice to have something different. I did have to use the
- JD-GUI
- Worked, but Procyon's output was much better. Here's a page comparing Procyon output to the original and JD-GUI. JD-GUI is also available as an Eclipse plugin, which didn't work for me at all. Doesn't seem to be open source and development seems sporadic.
- JAD
- Worked, but only supports Java 1.4 and below. Also available as an Eclipse plugin. No longer under development.
bmaupinbmaupin
votes
I use JAD Decompiler.
There is an Eclipse plugin for it, jadeclipse. It is pretty nice.
sakanasakana
votes
Janus TroelsenJanus Troelsen
votes
Soot is an option for newer Java code. At least it has the advantage of still being recently maintained...
Also, Java Decompiler is a decompiler with both a stand-alone GUI and Eclipse integration.
Lastly, Jdec hasn't been mentioned, though it's not as polished as other options.
Quinn TaylorQuinn Taylor
votes
JD-GUI is really good. You could just open a JAR file and browse through the code as ifyou are working on an IDE. Good stuff.
G KumarG Kumar
votes
Here's a list of decompilers as of Feb 2015:
Procyon, open-source, https://bitbucket.org/mstrobel/procyon/wiki/Java%20Decompiler
CFR, free, no source-code available, http://www.benf.org/other/cfr/
JD, free for non-commercial use only, http://jd.benow.ca/
Fernflower, open-source, https://github.com/fesh0r/fernflower,
JAD – given here only for historical reason. Free, no source-code available, http://varaneckas.com/jad/Outdated, unsupported and does not decompile correctly Java 5 and later.
You may test above-mentioned decompilers online, no installation required and make your own educated choice.
Java decompilers in the cloud:http://www.javadecompilers.com/
Andrew RukinAndrew Rukin
votes
There are a few programs you can use. You will get the actual Java code, but sometimes the code will have been obfuscated so methods are named by one letter or number or a random mix of letters and numbers.
Mike PoneMike Pone
votes
Most decompilers for Java are based on JAD. It's a great tool, but unfortunately hasn't been updated for a while and does not handle Java 1.5+ classes very well. I have not seen any tools that will properly handle 1.5+ classes.
John MeagherJohn Meagher
votes
Paulo GuedesPaulo Guedes
votes
All of the JAD links listed so far far seem to be broken, so I found this site. Works great (for Linux, at least)! On Ubuntu 11.10 I had to download the static one for whatever reason.
kdazzlekdazzle
votes
- JAD is one that works and is simple.
- Also, if you just want to see the methods, use javap.
Berlin BrownBerlin Brown
votes
If you want to see how the Java compiler does certain things, you don't want decompilation, you want disassembly. Decompilation involves transforming the bytecode into Java source, meaning that a lot of low level information is lost, and if you're wondering about compiler optimization, this is probably the very information you're interested in.
Anyway, I happen to have written an open source Java disassembler. Unlike Javap, this works even on highly pathological classes, so you can see what obfuscation tools are doing to your classes as well. It can also do decompilation, though I wouldn't recommend it.
AntimonyAntimony
votes
JAD doesn't work for me (Ubuntu 11.10 issue) so I've moved forward and sopped on JODO. At least it has Open Java source code and been able to decompile my .class properly.
I recommend to check out 'branches/generic' branch first. The trunks is not stable.
alexander.boxalexander.box
votes
On IntelliJ IDEA platform you can use Java Decompiler IntelliJ Plugin. It allows you to display all the Java sources during your debugging process, even if you do not have them all. It is based on the famous tools JD-GUI.
naXanaXa
vote
With AndroChef Java Decompiler you can decompile apk, dex, jar and java class-files. It's simple and easy. AndroChef JD is based on FernFlower. You can evaluate it in 10 free uses.
AndroChef supports Java language features like generics, enums and annotations. According to some studies, AndroChef Java Decompiler is able to decompile 98.04% of Java applications generated with traditional Java compilers - a very high recovery rate. It is simple but powerful tool that allows you to decompile Java and Dalvik bytecode (DEX, APK) into readable Java source.
naXanaXa
vote
For OSX I recommend: jarzilla or JD-GUI
They both allow you to view jar,war,etc. file content and decompiles any class files inside of them.
Jarzilla: https://code.google.com/p/jarzilla/
JD-GUI: http://jd.benow.ca/
JD-GUI: http://jd.benow.ca/
cjacksoncjackson