使用 JD-GUI 批量反编译 Java 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1384619/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Batch decompiling of Java files with JD-GUI
提问by MemoryLeak
I'm looking for a program to batch decompile Java classes. I found JAD, but it didn't support some new features of Java, and the benefit of this program is that it can execute from command line and generate a *.java file automatically.
我正在寻找一个程序来批量反编译 Java 类。我找到了 JAD,但它不支持 Java 的一些新特性,这个程序的好处是它可以从命令行执行并自动生成一个 *.java 文件。
I also found JD-GUI. It supports most features of Java, but the shortcoming is that it can't do batch processing. You need to open the class file with the program and click save.
我还找到了 JD-GUI。它支持Java的大部分功能,但缺点是不能做批处理。您需要使用程序打开类文件,然后单击保存。
Is there a way to make JD-GUI do batch processing like JAD?
有没有办法让JD-GUI像JAD一样做批处理?
采纳答案by ChssPly76
Command line decompilation for JD-GUI is a highly requestedfeature but it's not implemented yet. Perhaps you can use the following workaround in the meantime:
JD-GUI 的命令行反编译是一项非常受欢迎的功能,但尚未实现。也许您可以同时使用以下解决方法:
- jar (or zip) all the classes you want decompiled together.
- Launch JD-GUI and open your jar (zip) archive.
- Use "File" - "Save JAR Sources" menu option. It will decompile all classes from your archive and save their sources into another zip file.
- jar(或 zip)你想一起反编译的所有类。
- 启动 JD-GUI 并打开您的 jar (zip) 存档。
- 使用“文件”-“保存 JAR 源”菜单选项。它将从您的存档中反编译所有类,并将其源代码保存到另一个 zip 文件中。
I haven't seen any good open source JD-GUI alternatives with command-line support, unfortunately, so I think the above is as good as it gets for now.
不幸的是,我还没有看到任何具有命令行支持的好的开源 JD-GUI 替代品,所以我认为上面的内容和现在一样好。
回答by ivmai
I could recommend using Jad in conjuction with JadRetro- of course, it can't make Jad produce java generics but the decompiled source (including for Java 1.5+ classes) is functionally equivalent to the original (and back compilable in most cases).
Its use is simple:
我可以推荐将 Jad 与JadRetro结合使用——当然,它不能让 Jad 生成 Java 泛型,但反编译的源代码(包括 Java 1.5+ 类)在功能上与原始源代码等效(并且在大多数情况下可以反向编译)。
它的使用很简单:
jadretro *.class
jad .class
jadretro *.class
jad .class
Notes:
1. JadRetro could be used in batch mode like this: jadretro ...
2. If you are using jad v1.5.8e (instead of the latest v1.5.8g) then "-c" option should be passed to jadretro (otherwise jad will refuse to decompile Java 1.5+ classes).
注意:
1. JadRetro 可以像这样在批处理模式下使用:jadretro ...
2. 如果您使用的是 jad v1.5.8e(而不是最新的 v1.5.8g),则应将“-c”选项传递给 jadretro (否则 jad 将拒绝反编译 Java 1.5+ 类)。
回答by Ryan
It looks like you can launch the GUI with a whole bunch of libs at once using the command line and then CTRL+ALT+s/CTRL+w each tab to quickly save/close. It's not automated but tolerable when decompiling a pile of dependencies. (Note that the "^" is just a trick for doing multi-line commands in Windows.)
看起来您可以使用命令行一次启动带有一大堆库的 GUI,然后按 CTRL+ALT+s/CTRL+w 每个选项卡快速保存/关闭。在反编译一堆依赖项时,它不是自动化的,但可以容忍。(请注意,“^”只是在 Windows 中执行多行命令的一个技巧。)
"c:\jd-gui-0.3.6.windows\jd-gui.exe" ^
c:\my-libs\lib-a.jar ^
c:\my-libs\lib-b.jar ^
c:\my-libs\lib-c.jar ^
c:\my-libs\lib-d.jar ^
c:\my-libs\lib-e.jar
回答by Esther
File > Save all sources will save all files in the home directory.
文件 > 保存所有源将保存主目录中的所有文件。