IBM Support

Searching Java Archive (JAR) files for a class or a list of classes

Technote (troubleshooting)


How to search for a class or retrieve a list of classes contained in a Java™ Archive (JAR) file.

Resolving the problem

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.

  1. 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`
      jar -tvf $i  > list.out 2>&1

  2. 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

Cross reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK

Document information

More support for: WebSphere Application Server
Java SDK

Software version: 6.0, 6.1, 7.0, 8.0, 8.5, 8.5.5

Operating system(s): AIX, Linux

Software edition: Base, Enterprise, Express, Network Deployment, Single Server

Reference #: 1023498

Modified date: 22 March 2013

Translate this page: