How-to · Free

How to open a WAR, JAR or EAR file on a Mac

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.

WAR JAR EAR WEB-INF META-INF

With Peek

Browse the archive like a folder

Everything in this section is free.

1

Open the file

Drag the .war, .jar or .ear onto the Peek window, or choose File ▸ Open Archive… (⌘O).

2

Browse it

Expand WEB-INF, META-INF or any package. Selecting an entry shows its details in the inspector. Nothing is extracted.

3

Read a file

Select web.xml, MANIFEST.MF or a properties file and press Space for Quick Look.

4

Find something

Edit ▸ Find (⌘F) searches file names. Switch the scope to Contents to search inside text files too.

5

Take out only what you need

Select one or more entries and extract them, or drag them to Finder. The rest of the archive stays packed.

From the Terminal

List and read with unzip or jar

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

Is a WAR file just a ZIP?

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.

Can I open a JAR that is inside a WAR?

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.

Do I need Java installed to open a WAR in Peek?

No. Peek reads the archive itself and does not run Java.

Does opening a WAR in Peek change it?

No. Opening, browsing, previewing, searching and extracting never modify 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.