Can you recommend a Java decompiler for Eclipse? My other questions is what restrictions is there for using a decompiled code from an other Java program? Illegal or what? I dont know much about licenses. Thanks for reading.
-
Similar discussion is in [Choose and test java decompiler](http://stackoverflow.com/questions/3898391). – dma_k Jan 02 '12 at 14:48
-
"Eclipse Class Decompiler" maybe? site location is `http://feeling.sourceforge.net/update/` . read more http://www.blogjava.net/cnfree/archive/2012/10/30/390457.html, and http://feeling.sourceforge.net/ – Adriano Nov 13 '13 at 10:59
-
9Interesting that these questions are closed as off-topic, as many programmers such as myself come to SO for these exact problems (And find the answers, thanks to the answers posted below). Additionally, according to the "Ask" portion of this site, questions should "generally cover...software tools commonly used by programmers." – Bryan Larson Nov 25 '13 at 15:43
-
I've made a list: https://community.jboss.org/people/ozizka/blog/2014/05/06/java-decompilers-a-sad-situation-of – Ondra Žižka May 07 '14 at 03:23
7 Answers
I'd suggest the one that pops up on google, which is the JD Java decompiler. It works really nice.
As for the restrictions, you'd have to read a license of particular software, there might be written that any way of decompilation is forbidden.

- 32,208
- 39
- 178
- 361

- 7,883
- 1
- 32
- 23
-
3+1 - read the license. *"I dont know much about licenses."* is not a valid excuse if you get sued for breaching the license terms. – Stephen C Dec 07 '10 at 10:24
-
1
-
1JD-GUI fails to decompile types weaven by aspectj - the presented Java code is truncated. – mark Dec 08 '11 at 11:41
-
3I am working on a wrapper around JD-Eclipse to make it even better: http://mchr3k.github.com/jdeclipse-realign/ – mchr Aug 28 '12 at 00:18
I like JadClipse - but it shows its age in places. You will need:
- a jad binary
- jadClipse installed
- point the Eclipse preferences to the above jad binary
- tell it to produce line numbers and align for debugging
There are several shortcomings:
- code is produced sequentially, if byte code was rearranged so something comes late in the byte code but was early in the original source jad does not rewind to put the disassembled code to the right line.
- jad does not understand Java 5 + 6 bytecode very well.

- 3,452
- 1
- 26
- 23

- 73,784
- 33
- 194
- 347
I have tried several decompilers and most of them have failed to produce a correct source for the applet I was trying to decompile (which was http://mrl.nyu.edu/~perlin/experiments/emotive-actors/, in case anyone wants to reproduce).
The one which has worked absolutely flawlessly was Cavaj 1.11, the code produced by it contains no syntax errors and the applet compiled from the sources runs identically to the original. What I was missing on the UI side was: Ctrl-A/Ctrl-C keyboard shortcuts not working, and no batch conversion available.
The other decompilers I have tried were:
- JD Java decompiler (freeware) looks nice, but it made a lot of mistakes with variable declarations (some declarations were missing, other were placed badly)
- Neshkov DJ Java Decompiler (shareware) also looks nice, the code produced by it contained less syntax errors then JD, but the code was not working. Given the product is not free, one would expect a bit more from it.
-
2Cavaj is just a wrapper for Jad. Jad unfortunately isn't maintained and is missing support for Java 6/7, e.g. it doesn't support static imports. – rustyx Mar 04 '13 at 08:48
-
JD-GUI fails to decompile types weaven by aspectj - the presented Java code is truncated. – mark Dec 08 '11 at 11:42
I can not answer your first question: it would be biased, perhaps...
About your second question, the decompilation is LEGAL. This point is very important for me. Take a look on this interesting page : http://www.program-transformation.org/Transform/LegalityOfDecompilation

- 1,407
- 10
- 12
-
It's only legal under certain circumstances in the United States. At least, according to that link which you provided. – Jon L. Sep 02 '13 at 18:43
I found JD to be very good. Though, there were one or two minor bugs I came across that resulted in unexpected behaviour at runtime.
For example, I had an example where the original case statement didn't have a 'break' on the last node (because naturally this is unnecessary), but because JD ended up re-ordering the nodes it meant the 'default' case was called unexpectedly. I also had an issue with character sets where I required some extra toString() calls on the end of things for it to log out as expected. Apart from that it was great!
I used another decompiler DJ to help me work out what was wrong with the code decompiled by JD. But there were other things that DJ couldn't handle, so I guess a mixture of both decompilers worked for me :)
Hopefully Mr Dupuy will read this!

- 3,452
- 1
- 26
- 23

- 27
- 1
-
JD-GUI fails to decompile types weaven by aspectj - the presented Java code is truncated. – mark Dec 08 '11 at 11:43