Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I decompile many jars at once?

Well, I guess subject says it all :)

The ideal solution would find all jars within a certain folder (they might be in sub-folders), and write all the sources found into a single "src" directory, of course maintaing the package folders.

Concrete use case: decompile all Eclipse plugin jars

like image 986
Tom Avatar asked Jan 25 '11 12:01

Tom


2 Answers

Download JAD Decompiler.

  • Unjar all your jar files (using the command jar xvf) to some directory. Let's call this ${unjar.dir}.

  • Create a directory for JAD to write out the decompiled sources. Let's call this ${target.dir}.

  • Execute the following command:

    jad -o -r -sjava -d${target.dir} ${unjar.dir}/**/*.class

options are:

-o       - overwrite output files without confirmation
-r       - restore package directory structure
-s <ext> - output file extension (default: .jad)
like image 103
dogbane Avatar answered Sep 21 '22 19:09

dogbane


http://java.decompiler.free.fr/

like image 29
ehsun7b Avatar answered Sep 22 '22 19:09

ehsun7b