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 can cause problems on many platforms. Including the
version number for the application in the filename is a good idea,
because it is helpful for users to know which version of the
application the file contains.
Get JavaServer Pages, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.