|
Problem |
How to search for a class or retrieve a
list of classes contained in a JAR file. |
|
|
|
Solution |
You can search through JAR files in two
different ways. When executed using the steps below, both methods will put
the list of all .class files into a list.out file.
- Enter the following lines within a script file on a
Unix® server. Do this in the directory containing the JAR files:
for i in `ls *.jar`
do
jar -tvf $i > list.out 2>&1
done
- You can also enter the following method at a Unix
command prompt. Make sure that this is run while in the directory
containing the JAR files:
find . -name "*.jar" -exec jar -tvf {} \; > list.out
2>&1
The JAR command writes its output to
stderr and therefore you must put it to a
file. Otherwise it scrolls by on the screen.
Finally, in order to find a specific class, you can
either edit the file or enter the following at a Unix command prompt:
cat list.out | grep DummyKeyring |
|
|
|
|
|
|