使用JD-GUI批量反编译Java文件

发布于 2024-08-04 04:06:43 字数 183 浏览 2 评论 0原文

我正在寻找一个批量反编译Java类的程序。我找到了JAD,但它不支持Java的一些新特性,而这个程序的好处是它可以从命令行执行并自动生成*.java文件。

我还找到了JD-GUI。它支持Java的大部分功能,但缺点是不能做批处理。您需要使用程序打开类文件并单击“保存”。

有没有办法让JD-GUI像JAD一样进行批处理?

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.

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.

Is there a way to make JD-GUI do batch processing like JAD?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

撑一把青伞 2024-08-11 04:06:43

JD-GUI 的命令行反编译是一项强烈要求的功能,但尚未实现然而。也许您可以同时使用以下解决方法:

  1. jar(或zip)您想要反编译的所有类。
  2. 启动 JD-GUI 并打开您的 jar (zip) 存档。
  3. 使用“文件”-“保存 JAR 源”菜单选项。它将反编译存档中的所有类并将其源代码保存到另一个 zip 文件中。

不幸的是,我还没有看到任何具有命令行支持的好的开源 JD-GUI 替代品,所以我认为上面的内容已经是目前为止最好的了。

Command line decompilation for JD-GUI is a highly requested feature but it's not implemented yet. Perhaps you can use the following workaround in the meantime:

  1. jar (or zip) all the classes you want decompiled together.
  2. Launch JD-GUI and open your jar (zip) archive.
  3. Use "File" - "Save JAR Sources" menu option. It will decompile all classes from your archive and save their sources into another zip file.

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.

缘字诀 2024-08-11 04:06:43

我建议将 Jad 与 JadRetro 结合使用 - 当然,它不能使 Jad 生成 java 泛型,但反编译源(包括 Java 1.5+ 类)在功能上与原始源等效(并且在大多数情况下可反向编译)。
它的使用很简单:

jadretro *.class
jad .class

注释:
1. JadRetro 可以在批处理模式下使用,如下所示: jadretro ...
2. 如果您使用的是 jad v1.5.8e(而不是最新的 v1.5.8g),则应将“-c”选项传递给 jadretro(否则 jad 将拒绝反编译 Java 1.5+ 类)。

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:

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).

死开点丶别碍眼 2024-08-11 04:06:43

看起来您可以使用命令行一次启动带有一大堆库的 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

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.)

"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
把人绕傻吧 2024-08-11 04:06:43

文件>保存所有源将保存主目录中的所有文件。

File > Save all sources will save all files in the home directory.

听风念你 2024-08-11 04:06:43

JD-GUI 能够将类文件批量导出为 .java 文件,并压缩在 jar 文件中。

不过这个功能不是通过命令行控制的,而是通过鼠标点击来控制的,这个不稳定,有时会卡住。

您可以使用 jd-cli ( https://github .com/kwart/jd-cli/releases/tag/jd-cli-1.2.0)。

  1. 准备您的 .jar 文件(包含类),
  2. 输入:jd-cli target.jar -od jar_result -g ALL

,您将获得一个压缩的 java 源代码文件。

JD-GUI has the ability to batch export class files into .java file, zipped in a jar file.

however, this feature is not controlled by command line, but mouse clicking, this is not stable and sometimes will be stuck.

You can use jd-cli ( https://github.com/kwart/jd-cli/releases/tag/jd-cli-1.2.0 ).

  1. prepare your .jar file (containing classes )
  2. input: jd-cli target.jar -od jar_result -g ALL

and you will get a zipped java source code file.

莫相离 2024-08-11 04:06:43

命令行中的批量反编译从未添加,因为菜单 File ->保存所有源 已经满足了这一需求。

对于命令行界面,kwart 的 jd-cli 现在是:
https://github.com/intoolswetrust/jd-cli

也是 jd-gui 的一个分支可以在这里找到:
https://github.com/nbauma109/jd-gui-duo

The batch decompilation in command line was never added because a menu File -> Save All Sources already addresses this need.

For command line interface, kwart's jd-cli is now:
https://github.com/intoolswetrust/jd-cli

Also a fork of jd-gui is available here:
https://github.com/nbauma109/jd-gui-duo

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文