-->

Java Decompiler [closed]

2019-01-11 23:01发布

问题:

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.

回答1:

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.



回答2:

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:

I have used this eclipse plugin: JadClipse

and this java decompiler: JAD



回答4:

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.


回答5:

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



回答6:

JD is the best Java Decompiler I know.



回答7:

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!