.war

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.

Category
Archive
Type
Binary
Is a .war file safe to open? Caution. A WAR contains a runnable web application. Deploy only WARs you trust; inspecting one as a ZIP is safe.

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.

How to open 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. For a step-by-step walkthrough, see how to open a .war file.

Windows

  • Apache Tomcat (deploy)
  • 7-Zip (to inspect)
  • IntelliJ IDEA

macOS

  • Apache Tomcat (deploy)
  • The Unarchiver
  • IntelliJ IDEA

Linux

  • Apache Tomcat (deploy)
  • unzip

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.

.war file signature (magic bytes)

Programs recognise a .war file by the bytes at the start of the file, not by its name. These are the signatures for WAR. For a full breakdown, see the WAR file signature page.

Hex signatureOffsetNote
50 4B 03 040ZIP 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: