How-to · Peek Pro

View and search the classes inside a JAR on a Mac

You want to know whether a class is in the build, which methods it has, or who refers to it, and you do not have the source at hand. Both ways below read the compiled classes straight from the archive.

JAR WAR EAR .class Peek Pro

With Peek

Browse classes by package

The class browser is part of Peek Pro, which you can try free for 14 days.

1

Open the archive

Open the .jar, .war or .ear in Peek.

2

Open the class browser

Choose Archive ▸ Browse Java Classes…, or Browse Classes… on the archive's panel.

3

Go through the packages

Classes are grouped by package, and the list includes the classes of the JARs the archive bundles, such as those under WEB-INF/lib.

4

Read a class

View it as an outline of its fields and methods, or as bytecode. References to other classes are links you can follow.

5

Search

Search classes, methods, fields and text across the whole archive.

From the Terminal

Print a class with javap

javap comes with a JDK and reads a class from a JAR on the class path.

# Which classes are in the JAR
unzip -Z1 app.jar | grep '\.class$'

# Members of one class, private ones included
javap -p -cp app.jar com.example.OrderService

# The same with bytecode
javap -p -c -cp app.jar com.example.OrderService

javap does not look inside nested JARs: for a class in a library under WEB-INF/lib you have to extract that library first. It also prints one class at a time, with no search across the archive.

Questions

Is this a Java decompiler?

No. Peek shows declarations and bytecode, the same information javap prints, in a browsable form. It does not reconstruct Java source.

Does it need a JDK?

No. Peek has its own class-file reader and does not run Java.

Does it read classes inside nested JARs?

Yes. The classes of the JARs an archive bundles appear in the same browser.

Can I search for a string constant?

Yes. Search covers classes, methods, fields and text across the archive.

More how-to guides

Other things people do with a JAR or a WAR

Free to download

Open, browse and extract for free. Try Peek Pro for 14 days.

Peek is a native Mac app from the Mac App Store. Nothing is charged when the trial ends; Peek Pro is a one-time purchase, with no subscription and no account.