Previous Section  < Day Day Up >  Next Section

F.3 Creating a WAR File

A WAR file is an archive file, used to group all application files into a convenient package. A WAR file can be created with the jar command, included in the Java runtime environment, or a ZIP utility program such as WinZip. To create a WAR file, you first need to create the file structure as directories in the filesystem and place all files in the correct location as described earlier.

With the file structure in place, cd to the top-level directory for the application in the filesystem. You can then use the jar command to create the WAR file:

C:\> cd myapp

C:\myapp> jar cvf myapp_1_0.war *

This command creates a WAR file named myapp_1_0.war containing all files in the myapp directory. You can use any filename that makes sense for your application but avoid spaces in the filename, because they are known to cause problems on many platforms. Including the version number for the application in the filename is a good idea, because it is helpful for the users to know which version of the application the file contains.

    Previous Section  < Day Day Up >  Next Section