How To: Expand a WAR file


WAR is a compressed file format and follows a directory structure to define Web applications in a standard way.

There are several ways to open, expand, or uncompress a WAR file.


Instructions provided describe a few methods for expanding a WAR file.

  • Rename the .war file extension to .zip.

    Using any uncompression tool like WinZip, all contents can be extracted to a directory.

  • Extract the contents of a WAR file using the JAR utility provided with any installation of JSDK.

    jar xvf "C:\Program Files\ArcGIS\java\web_output\applications\California.war"

  • ArcGIS Server for Java Platform provides a customized ANT utility. Using the ANT utility, a simple build file can be written to expand the WAR file.

    Below is an example of the build.xml:


    <?xml version="1.0" encoding="ISO-8859-1"?>
    <project name="MyTask" basedir="." default="unpack">

    <property name="warfile" value="Redlands"/>

    <target name="unpack" depends="clean">
    <unwar src="${warfile}.war" dest="${warfile}" />

    <target name="clean">
    <delete dir="${warfile}" verbose="true"/>


    Save the above shown XML as build.xml. This file and the WAR file need to be in the same location.

    In the above build.xml, the name of the WAR file specified is Redlands. Modify the name as needed.

    Open a command prompt, navigate to the WAR file location and run the arcgisant command.

    Below is an example of the arcgisant command:


    C:\>cd "c:\Program Files\arcgis\java\web_output\applications"

    C:\Program Files\ArcGIS\java\web_output\applications>dir
    Volume in drive C is OSDisk
    Volume Serial Number is 084F-16DB

    Directory of C:\Program Files\ArcGIS\java\web_output\applications

    08/17/2007 12:18 PM <DIR> .
    08/17/2007 12:18 PM <DIR> ..
    08/17/2007 12:17 PM 1,000 build.xml
    10/13/2006 07:12 PM 24 readme.txt
    08/02/2007 12:24 PM 26,538,135 Redlands.war

    C:\Program Files\ArcGIS\java\web_output\applications>arcgisant
    Buildfile: build.xml


    [unwar] Expanding: C:\Program Files\ArcGIS\java\web_output\applications\Redlands.war into C:\Pro
    gram Files\ArcGIS\java\web_output\applications\Redlands


    If arcgisant is not in the classpath, use the exact location of arcgisant to execute 'C:\Program Files\arcgis\java\tools\ant\bin\arcgisant'.

Related Information