Using War Files

This page is not for senior developers.

** What is a .WAR file? **

Easy way to unpack/explode/expand a .war file

  1. Copy the war file into a new directory (to be certain you have a backup of it).

  2. Rename the the file to .zip.
    • Example: rename mifos. war to mifos.zip
  3. Extract the file into a new directory called mifos.

You can also use unjar. (details to be added)

The result will be something like these directories:

  • WEB-INF
  • META-INF
  • pages

What can you do now?

You can now make changes to files (like task.xml for batch files).

If you do not know the directory structure well enough to find the file you need, use the Windows Search tool to find the file in the directory.

You can use the files and deploy mifos

Instead of just putting a .war file into the deployment directory of your web server, you can put the unpacked files. Using this method, you can change configurations (see above) easily.

Example:

Using Jetty as my servlet, I can copy the mifos folder (containing all the files that I expanded out of the .war) into C:\jetty-6.1.5\webapps and run mifos.

How to create a new war file from your modified files

If you would rather just unpack the .war, make your changes, and repack the .war, refer to the example below.

You must have a Java SDK installed for this to work. How to install Java

::
  1. Go to the command prompt.
  2. cd c:\my_war_directory
  3. Run C:\my_war_directory>"c:\Program Files\java\jdk1.5.0_13\bin\jar.exe" -cvf mifos.war WEB-INF META-INF pages

where

  • "my_war_directory" is the directory in which all your files reside.
  • "c:Program Filesjavajdk1.5.0_13binjar.exe" represents the location where your Java SDK is installed.
  • "mifos.war" is the name of your new .war file
  • "WEB-INF META-INF pages" are the names of the directories and files you want in the .war.

0
Your rating: None