Java反编译器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4375037/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java Decompiler
提问by MartK
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.
你能推荐一个用于 Eclipse 的 Java 反编译器吗?我的另一个问题是使用来自其他 Java 程序的反编译代码有什么限制?违法还是什么?我对许可证了解不多。谢谢阅读。
采纳答案by Mirek Pluta
I'd suggest the one that pops up on google, which is the JDJava decompiler. It works really nice.
我建议在 google 上弹出一个,它是JDJava 反编译器。它真的很好用。
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.
至于限制,你必须阅读特定软件的许可证,可能会写明禁止任何反编译方式。
回答by Thorbj?rn Ravn Andersen
I like JadClipse- but it shows its age in places. You will need:
我喜欢JadClipse- 但它在某些地方显示了它的年龄。你会需要:
- a jad binary
- jadClipse installed
- point the Eclipse preferences to the above jad binary
- tell it to produce line numbers and align for debugging
- 一个 jad 二进制文件
- jadClipse 已安装
- 将 Eclipse 首选项指向上面的 jad 二进制文件
- 告诉它生成行号并对齐以进行调试
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.
- 代码是按顺序生成的,如果字节码被重新排列,那么字节码中的某些东西在字节码中出现较晚但在原始源代码中较早,jad 不会倒带将反汇编的代码放在正确的行中。
- jad 不太了解 Java 5 + 6 字节码。
回答by Emmanuel Dupuy
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
关于你的第二个问题,反编译是合法的。这一点对我来说非常重要。看看这个有趣的页面:http: //www.program-transformation.org/Transform/LegalityOfDecompilation
回答by Matthew Paterson
I found JDto be very good. Though, there were one or two minor bugs I came across that resulted in unexpected behaviour at runtime.
我发现JD非常好。不过,我遇到了一两个小错误,导致运行时出现意外行为。
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!
例如,我有一个示例,其中原始 case 语句在最后一个节点上没有“中断”(因为这自然是不必要的),但是因为 JD 最终对节点进行了重新排序,这意味着“默认”情况是意外地打电话。我也遇到了字符集问题,我需要在事情结束时进行一些额外的 toString() 调用才能按预期注销。除此之外,它很棒!
I used another decompiler DJto 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 :)
我使用了另一个反编译器DJ来帮助我找出 JD 反编译的代码有什么问题。但是还有其他 DJ 无法处理的事情,所以我猜这两种反编译器的混合对我有用:)
Hopefully Mr Dupuy will read this!
希望Dupuy先生能读到这个!
回答by Suma
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).
我尝试了几个反编译器,但大多数都无法为我试图反编译的小程序生成正确的源代码(这是http://mrl.nyu.edu/~perlin/experiments/emotive-actors/,以防万一想繁殖)。
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.
绝对完美运行的是Cavaj 1.11,它生成的代码不包含语法错误,并且从源代码编译的小程序与原始小程序运行相同。我在 UI 方面缺少的是:Ctrl-A/Ctrl-C 键盘快捷键不起作用,并且没有可用的批量转换。
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.
- JD Java 反编译器(免费软件)看起来不错,但它在变量声明方面犯了很多错误(一些声明丢失,其他的放置不当)
- Neshkov DJ Java Decompiler(共享软件)看起来也不错,它生成的代码包含的语法错误比 JD 少,但代码不起作用。鉴于该产品不是免费的,人们会对它抱有更高的期望。