Batch decompiling of Java files with JD-GUI

Viewed 56123

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?

5 Answers

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

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

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.

Related