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 myappC:\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
since they can cause problems on many platforms. Including the
version number of the application in the filename is a good idea,
since it is helpful for the users to know which version of the
application the file contains.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access