What is a .war file?
Web Application Archive · Archive · Sun Microsystems · 1999
A .war file is a Web Application Archive: a ZIP package that bundles a Java web application, its servlets, pages and libraries, for deployment to a server like Apache Tomcat.
What is a .war file used for?
A WAR is structured like a JAR but for web apps, with a WEB-INF folder holding classes, libraries and configuration. You deploy it to a servlet container, which unpacks and runs it.
Being a ZIP, it starts with the ZIP signature and opens in any archive tool for inspection.
What opens a .war file?
The .war format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list.
Windows
- Apache Tomcat (deploy)
- 7-Zip (to inspect)
- IntelliJ IDEA
macOS
- Apache Tomcat (deploy)
- The Unarchiver
- IntelliJ IDEA
Linux
- Apache Tomcat (deploy)
- unzip
Open a .war file step by step
- Confirm the file really is a .war. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
- On Windows, open it with Apache Tomcat (deploy) or 7-Zip (to inspect).
- On Mac, use Apache Tomcat (deploy) or The Unarchiver.
- On Linux, try Apache Tomcat (deploy) or unzip.
- Still stuck? Convert the .war to zip, which opens more widely.
Why can't I open my .war file?
Almost always because no installed app understands WAR. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.
The other possibility is that the file is not really a .war at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.
How to convert a .war file
You can convert a .war file to zip using a conversion tool or the export menu of an app that opens it.
What is the .war file signature (magic bytes)?
A .war file starts with the hex bytes 50 4B 03 04, which read as PK.. in ASCII. Programs identify WAR by those bytes, not by the filename, so a renamed file still gives itself away.
These are the documented signatures for WAR. For a full breakdown, see the ZIP file signature page.
| Hex signature | Offset | ASCII | Note |
|---|---|---|---|
| 50 4B 03 04 | 0 | PK.. | ZIP package (PK..) |
See the full magic-numbers reference for every format.
Frequently asked questions
What is a .war file?
A .war file is a Web Application Archive: a ZIP package that bundles a Java web application, its servlets, pages and libraries, for deployment to a server like Apache Tomcat.
How do I open a WAR file?
To inspect it, open it as a ZIP in 7-Zip. To run it, deploy it to a servlet container like Apache Tomcat by dropping it in the webapps folder.
What is the difference between a JAR and a WAR?
Both are ZIP packages of Java code. A JAR is a library or app; a WAR packages a full web application with a WEB-INF layout for a server.
How do I extract a WAR file?
Rename it to .zip and unzip it, or run jar -xvf app.war. Inside you will find WEB-INF and the web content.
Related formats
Sources
Details on this page were checked against authoritative references. How sources are ranked and what is deliberately left out is set out in the methodology.