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

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


当前回答

Procyon包含一个反编译器。它是自由/开源软件。

其他回答

JD-GUI真的很好。您只需打开一个JAR文件,然后浏览代码 你正在开发一个IDE。好东西。

这里有一些反编译器…快速搜索会得到:

Procyon:开源(Apache 2),积极开发 Krakatau:开源(GPLv3),并积极开发 CFR:开源(MIT)并积极开发 联合应用开发 DJ Java反编译器 摩卡

还有更多。

它们生成Java代码。Java自带一些功能,可以让您看到JVM字节代码(javap)。

Procyon包含一个反编译器。它是自由/开源软件。

我尝试了几种,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.

JAD不为我工作(Ubuntu 11.10问题),所以我已经前进和浸泡在JODO。至少它有Open Java源代码,并且能够正确地反编译我的.class。

我建议先查看“分支/通用”分支。树干不稳。