Open the file
Drag the .war, .jar or .ear onto the Peek window, or choose File ▸ Open Archive… (⌘O).
How-to · Free
A WAR, a JAR and an EAR are ZIP archives with a Java layout inside. macOS has no viewer for them: double-clicking a WAR does nothing useful, and renaming it to .zip unpacks everything when you only wanted one file. Here are two ways to look inside without unpacking.
With Peek
Everything in this section is free.
Drag the .war, .jar or .ear onto the Peek window, or choose File ▸ Open Archive… (⌘O).
Expand WEB-INF, META-INF or any package. Selecting an entry shows its details in the inspector. Nothing is extracted.
Select web.xml, MANIFEST.MF or a properties file and press Space for Quick Look.
Edit ▸ Find (⌘F) searches file names. Switch the scope to Contents to search inside text files too.
Select one or more entries and extract them, or drag them to Finder. The rest of the archive stays packed.
From the Terminal
macOS ships with unzip. jar comes with a JDK.
# List what is inside
unzip -l app.war
jar tf app.war
# Print one file without unpacking the rest
unzip -p app.war WEB-INF/web.xml
# Unpack everything into a folder
unzip app.war -d app-unpacked
This works well for one file whose path you already know. Browsing, previewing and searching by content are where a window saves time.
Questions
Yes. WAR, JAR and EAR use the ZIP format. What makes them different is the layout inside: WEB-INF in a WAR, META-INF/MANIFEST.MF in a JAR, modules in an EAR.
Yes. In Peek, the libraries under WEB-INF/lib are entries like any other; you can extract one and open it. With Peek Pro, Browse Java Classes shows the classes of those nested JARs directly.
No. Peek reads the archive itself and does not run Java.
No. Opening, browsing, previewing, searching and extracting never modify the archive.
More how-to guides
Free to download
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.