我可以使用什么程序来反编译类文件?我真的会得到Java代码,还是仅仅是JVM汇编代码?
关于这个网站上的Java性能问题,我经常看到一些人的回答,他们“反编译”了Java类文件,以了解编译器如何优化某些东西。
我可以使用什么程序来反编译类文件?我真的会得到Java代码,还是仅仅是JVM汇编代码?
关于这个网站上的Java性能问题,我经常看到一些人的回答,他们“反编译”了Java类文件,以了解编译器如何优化某些东西。
当前回答
大多数Java反编译器都是基于JAD的。这是一个很棒的工具,但不幸的是,它已经有一段时间没有更新了,并且不能很好地处理Java 1.5+类。我还没有看到任何能够正确处理1.5+类的工具。
其他回答
JD-GUI真的很好。您只需打开一个JAR文件,然后浏览代码 你正在开发一个IDE。好东西。
你可以使用一些程序。您将得到实际的Java代码,但有时代码会被混淆,因此方法由一个字母或数字或字母和数字的随机组合命名。
DJ解码器 摩卡
使用AndroChef Java反编译器,您可以反编译apk, dex, jar和Java类文件。这很简单。AndroChef JD基于FernFlower。你可以在10次免费使用中评估它。
AndroChef支持Java语言特性,如泛型、枚举和注释。根据一些研究,AndroChef Java Decompiler能够反编译98.04%的由传统Java编译器生成的Java应用程序——一个非常高的回收率。它是一个简单但功能强大的工具,允许您将Java和Dalvik字节码(DEX, APK)反编译为可读的Java源代码。
以下是截至2015年2月的反编译器列表:
Procyon,开源,https://bitbucket.org/mstrobel/procyon/wiki/Java%20Decompiler
CFR,免费,没有源代码,http://www.benf.org/other/cfr/
JD,仅供非商业用途免费,http://jd.benow.ca/
Fernflower,开源,https://github.com/fesh0r/fernflower,
JAD -此处仅为历史原因。免费,没有源代码,http://varaneckas.com/jad/ 过时,不受支持,不能正确反编译Java 5及更高版本。
您可以在线测试上述反编译器,不需要安装,并做出自己的选择。
云中的Java反编译器:http://www.javadecompilers.com/
我尝试了几种,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.