java - 如何反编译整个Jar文件?

标签 java jar decompiler

有没有人知道可以反编译整个 Jar 文件而不是单个类的免费反编译器?我对像 name$1.class name$2.class name.class 这样的子类有疑问

最佳答案

2022 年更新:QuiltMC/quiltflower是最新的most advanced Java decompiler :

Quiltflower 是一款现代化的通用反编译器,专注于提高代码质量、速度和可用性。
Quiltflower 是 Fernflower 的一个 fork 和 Forgeflower。

Changes include:

  • New language features (Try with resources, switch expressions, pattern matching, and more)
  • Better control flow generation (loops, try-catch, and switch, etc.)
  • More configurability
  • Better error messages
  • Javadoc application
  • Multithreading
  • Optimization
  • Many other miscellaneous features and fixes

Originally intended just for use with the QuiltMC toolchain with Minecraft, Quiltflower quickly expanded to be a general purpose java decompiler aiming to create code that is as accurate and clean as possible.

If the name sounds familiar it's because Quiltflower is a fork of Fernflower, the (in)famous decompiler that was developed by Stiver, maintained by Jetbrains, and became the default decompiler in Intellij IDEA.
Fernflower also quickly found its way into many other tools.

Over the past year, Quiltflower has added support for features such as modern string concatenation, a code formatter, sealed classes, pattern matching, switch expressions, try-with-resources, and more. Quiltflower also focuses on the code quality of the decompiled output, and takes readability very seriously.

output examples .

Runs nice with jbang

https://github.com/QuiltMC/quiltflower/releases/download/1.8.1/quiltflower-1.8.1.jar

或者:

java -jar quiltflower.jar -dgs=1 c:\Temp\binary\library.jar c:\Temp\binary\Boot.class c:\Temp\source\

2009: JavaDecompiler可以用 jar 做好:从 0.2.5 开始,JAR 文件中的所有文件都会显示出来。

http://java.decompiler.free.fr/sites/default/screenshots/screenshot1.png

另见 the question "How do I “decompile” Java class files?" .

不过,自 2009 年底以来,JD-Eclipse 似乎并没有改变(参见 Changes)。
所以它与最新的 Eclipse(3.8、4.2+)的集成可能会出现问题。

JD-Core 得到积极维护。

两者都是(SO 用户)Emmanuel Dupuy 出色工作的结果.


2018:更现代的选择,提到 in the commentsDavid Kennedy Araujo :

JetBrains/intellij-community/plugins/java-decompiler/engine

Fernflower is the first actually working analytical decompiler for Java and probably for a high-level programming language in general.

java -jar fernflower.jar [-<option>=<value>]* [<source>]+ <destination>

java -jar fernflower.jar -hes=0 -hdc=0 c:\Temp\binary\ -e=c:\Java\rt.jar c:\Temp\source\

另见 How to decompile to java files intellij idea使用最新的 IntelliJ IDEA 的命令。


2022 年更新:Florian Wendelborn建议在 the comments

this one works well: jdec.app from Leonardo Santos.

关于java - 如何反编译整个Jar文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/671394/

相关文章:

java - 使用 libgdx 通过 Eclipse 导出可运行的 .jar 文件

c - 使用 C 或 C++ 反编译 CHM(帮助)文件

java - 是否有任何 Java 反编译器可以正确反编译对重载方法的调用?

programming-languages - 是否有可能知道 exe 文件是用什么语言编写的?

java - 如何禁用tomcat缓存?

Java异常: get detailMessage only

java - 分析单词文本的算法

java - 如何使用 OPENSHIFT_DATA_DIR 环境变量在 Openshift 应用程序中引用自定义文件

Java线程似乎无法正常运行

java - 如何更改 Eclipse 项目的 JDK 版本