English

How To: Expand a WAR file

Summary

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.

Procedure

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.
    Code:

    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:

    Code:

    <?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>

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

    </project>


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


    Note:
    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:

    Code:

    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

    clean:

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

    BUILD SUCCESSFUL


    Note:
    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