我可以使用什么程序来反编译类文件?我真的会得到Java代码,还是仅仅是JVM汇编代码?

关于这个网站上的Java性能问题,我经常看到一些人的回答,他们“反编译”了Java类文件,以了解编译器如何优化某些东西。


当前回答

我尝试了几种,Procyon似乎最适合我。它正在积极开发中,支持最新版本Java的许多特性。

以下是我尝试过的其他方法:

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. 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.

其他回答

查看Java源代码,检查一些反编译器。去找贾德。

如果您想查看字节码,只需使用JDK附带的javap即可。

看看卡瓦伊。

Soot是较新的Java代码的一个选项。至少它的优点是最近还在维护……

此外,Java反编译器是一个具有独立GUI和Eclipse集成的反编译器。

最后,还没有提到Jdec,尽管它没有其他选项那么完善。

到目前为止列出的JAD链接似乎都是坏的,所以我找到了这个网站。工作得很好(至少对于Linux)!在Ubuntu 11.10上,不知什么原因,我不得不下载静态版本。

http://www.varaneckas.com/jad

JAD是一种有效且简单的方法。 另外,如果您只想查看方法,请使用javap。