Что такое формат файла WAR?
.war (Java Web Archive) is an archive format similar to a JAR file, built on the standard ZIP container. .war files contain Java web applications and server-side components that can be deployed and run on a servlet container such as Apache Tomcat or Jetty. Besides compiled .class files, the archive can store additional resources to be run on the server, including .jsp pages, static HTML and CSS. The mandatory WEB-INF/ directory holds the web.xml deployment descriptor and a lib/ folder for bundled dependency .jar files.
Using .war files
A .war file, just like any archive, can be unpacked to view the source code and other resources - rename it to .zip and open it with any archive tool. The execution environment, however, requires the application to remain in .war format for deployment; the servlet container handles class-loading and request routing. Modern Spring Boot projects often ship a self-contained fat-JAR instead of a .war, but WAR deployment stays standard on Jakarta EE servers such as WildFly and WebSphere. .war is the web-application counterpart to .EAR archives, which bundle full enterprise applications.
Безопасность и защита
РИСК: MEDIUMA WAR contains executable server-side code (compiled servlets and bundled JAR libraries), so deploying one runs that code on your server with the server's privileges. Only deploy WARs from trusted sources; a malicious or compromised WAR can host a web shell or vulnerable dependencies. Inspecting (rename to .zip) is safe; deploying is the risky step. Keep your servlet container and the WAR's bundled libraries patched (supply-chain risk, e.g. vulnerable logging libraries).
Детали формата
в двух словах- Konqueror web archive - KDE's Konqueror could save a web page (and assets) as a .war archive - the (mislabeled) db_name; a rare, legacy KDE use, not the dominant format.
- WAR (audio/sample) and game data - A few legacy tools used .war for raw audio samples or game asset archives (e.g. some engines); unrelated to the Java format.
Программы, открывающие файлы WAR
Технические подробности
глубокая спецификация| Container format | ZIP archive; magic bytes PK (0x50 0x4B 0x03 0x04) at offset 0 - identical to standard ZIP |
| Compression method | DEFLATE per-entry (ZIP default); individual entries may be STORED uncompressed |
| MIME type | application/java-archive |
| Byte order | Little-endian (inherited from ZIP specification) |
| Required directory structure | Must include WEB-INF/ folder containing web.xml deployment descriptor, classes/ and lib/ subdirectories |
| Encoding | Binary |
| Typical file size | 1 MB - 300 MB; varies with number of bundled dependency JARs and static assets |
| Integrity / signing | Per-entry CRC-32; optional JAR code-signing via META-INF/ .SF / .RSA signature files |
| Max archive entries | 65,535 (standard ZIP); ZIP64 extension lifts this limit |
| Deployment target | Servlet containers and Jakarta EE application servers: Apache Tomcat, Jetty, WildFly, GlassFish, WebSphere |
| Version declaration | Servlet/Jakarta EE spec version stated in WEB-INF/web.xml <web-app> element; optional META-INF/MANIFEST.MF |
| Class isolation | Each deployed WAR gets an isolated classloader; prevents library version conflicts between co-deployed applications |
| Hierarchy in Java EE packaging | WAR is the web-application tier; JAR holds libraries/apps; EAR (Enterprise Archive) wraps WARs and EJB JARs into one deployable unit |
| Platform support | Cross-platform; runs on any OS with a JVM and compatible servlet container (Windows, Linux, macOS) |
| Hot deployment | Most servlet containers support deploying or replacing a WAR file without full server restart (drop-in deployment) |
| Выпущен | 1999 (Java Servlet 2.2 / J2EE 1.2) |
| Последняя версия | Tracks Jakarta EE / Servlet spec (Jakarta Servlet 6.0, 2022); WAR layout itself is stable |
| Открыть стандартное | Да · без роялти |
| Спецификация | jakarta.ee |
Конвертации WAR
Вопросы и ответы сообщества
спрошено пользователямиВопросов пока нет - станьте первым, кто спросит о файлах WAR.