views:

1318

answers:

3

I'm looking for a program to batch decompile java classes. And 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.

And i found jd-gui.exe program, it supports most features of java. But the shortcomming is that it can't do batch processing, you need to open the class file with the program and click save.

So I want to know whether or not there is a jd-gui.exe program, that can do the same with JAD program and batch generate the *.java file in the right folder?

Or any other batch process software for decompiling?

thanks in advance!

+5  A: 

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.

ChssPly76
Really very very very very very thanks !You help me a lot!
MemoryLeak
You're very welcome
ChssPly76
A: 

I could recommend using Jad in conjuction with JadRetro (jadretro.sf.net) - 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).

ivmai
A: 

You could automate the Save operation using AutoHotKey script. See similar example at http://www.elementsvillage.com/forums/showthread.php?t=41912

The script above loops through .jpg files and applies a filter, so you could loop .class files, or combine it with the "fake jar" suggestion above.

Dekel