1

I want to decompile .class files in many directories and then save output of every file to file with the same name (of course with different extension). I tried to set classpath, but I receive some errors that one of directories wasn't found, but it's nonsense so I think that I am doing someting wrong. (javap -classpath path/to/files/ -c *).

I want to do it using javap, I don't want to use libraries, programs, etc. Greets.

2 Answers 2

2

This is the solution:

javap -classpath yourjar.jar -c $(jar -tf yourjar.jar | grep class | sed 's/.class//g')
1
  • How is this to be run? It seems to dump everything to stdout on my system, and redirecting the output to a file would seem to defeat the purpose
    – Cajunluke
    Jan 28, 2013 at 18:15
0

To save to separated files:

for i in $(jar -tf yourjar.jar | grep class | sed 's/.class//g') ; do mkdir -p $(dirname $i) ; javap -cp yourjar.jar -c $i > $i.javap ; done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.