I want to list the methods of the class files in the jar using the javap tool. How do I do it so that it lists the methods and members of all the class files in the jar. Right now I am able to do it for just one class at a time.
I am expecting something like if I say
javap java.lang.*
it should enlist the methods and members of all the classes in java.lang package. If javap is not capable of that, are there any such tools available?
The javap command disassembles one or more class files. Its output depends on the options used. If no options are used, javap prints out the package, protected, and public fields and methods of the classes passed to it.
A simple way to see what String literals are used in a ". class" file is to use the javap utility in your JDK installation to dump the file using the "-v" option. Then grep for text that looks like <String "..."> where ... is the String you are looking for.
The javap command disassembles a class file. The javap command displays information about the fields, constructors and methods present in a class file.
#!/bin/bash # Set the JAR name jar=<JAR NAME> # Loop through the classes (everything ending in .class) for class in $(jar -tf $jar | grep '.class'); do # Replace /'s with .'s class=${class//\//.}; # javap javap -classpath $jar ${class//.class/}; done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With