[英]How to decompile a jar into .java files from command prompt
如何从命令提示符将 JAR( .class
二进制文件)反编译为.java
源文件?
I found that jd-cmd does the job just fine, and works recursively in sub-folders for multiple files.我发现jd-cmd可以很好地完成这项工作,并且可以在多个文件的子文件夹中递归工作。 To decompile a group of files on the command line, run the following commands:
要在命令行上反编译一组文件,请运行以下命令:
README.md
file .README.md
文件。java -jar jd-cli.jar -od <my-output-folder> <my-input-folder>
.java -jar jd-cli.jar -od <my-output-folder> <my-input-folder>
。in 2021, seems the command line is more simple:在 2021 年,命令行似乎更简单:
decompile target.jar to jar_result
folder, and output the log with ALL
levels.将
jar_result
反编译到jar_result
文件夹,输出ALL
级别的日志。
$ jd-cli target.jar -od jar_result -g ALL
This GitHub project claims to be able to do so. 这个GitHub 项目声称能够做到这一点。 However, most people I know use JD-GUI .
但是,我认识的大多数人都使用JD-GUI 。
JD-Core is a library that reconstructs Java source code from one or more “.class” files.
JD-Core 是一个从一个或多个“.class”文件重构 Java 源代码的库。 JD-Core may be used to recover lost source code and explore the source of Java runtime libraries.
JD-Core 可用于恢复丢失的源代码并探索 Java 运行时库的来源。 New features of Java 5, such as annotations, generics or type “enum”, are supported.
支持 Java 5 的新特性,例如注释、泛型或类型“枚举”。 JD-GUI and JD-Eclipse include JD-Core library.
JD-GUI 和 JD-Eclipse 包含 JD-Core 库。
I should include that when a source file is compiled, things like the variable assignment and the names of those variables are changed.我应该包括在编译源文件时,诸如变量赋值和这些变量的名称之类的内容会发生变化。 Similarly, syntactic sugar is changed into what it actually is (such as
x += i
turns into x = x + i
).类似地,语法糖变成了它实际的样子(例如
x += i
变成了x = x + i
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.