File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Creating a WAR file ...... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Creating a WAR file ......" Watch "Creating a WAR file ......" New topic

Creating a WAR file ......

Gabriel Fox
Ranch Hand

Joined: Oct 17, 2001
Posts: 170
Hi guys . How do you create a Web Application Archive File for an enterprise WebApp ?
What factors are to be considered when using a WAR file .
All references and codes will be appreciated .
Chana Campos

Joined: Jun 09, 2002
Posts: 19
A .war file is created using the jar utility that comes with your plain JDK. The syntax is fairly straightforward. You need to make sure your directory structures and files are in the correct locations first. The syntax is basically the same whether it is a .war, .jar, or .ear file. You just append that suffix onto the new file that you are creating...
Usage: jar {ctxu}[vfm0M] [jar-file] [manifest-file] [-C dir] files ...
-c create new archive
-t list table of contents for archive
-x extract named (or all) files from archive
-u update existing archive
-v generate verbose output on standard output
-f specify archive file name
-m include manifest information from specified manifest file
-0 store only; use no ZIP compression
-M do not create a manifest file for the entries
-i generate index information for the specified jar files
-C change to the specified directory and include the following file
If any file is a directory then it is processed recursively.
The manifest file name and the archive file name needs to be specified
in the same order the 'm' and 'f' flags are specified.
Example 1: to archive two class files into an archive called classes.jar:
jar cvf classes.jar Foo.class Bar.class
Example 2: use an existing manifest file 'mymanifest' and archive all the
files in the foo/ directory into 'classes.jar':
jar cvfm classes.jar mymanifest -C foo/ .
This is straight from help - let me know if there is anything else I can help with..
Steven Wong
Ranch Hand

Joined: Mar 07, 2002
Posts: 295
Of course you can also use the famous ant compiler tool to package up your WAR, JAR or EAR.
You can get more info here:

best regards,<br />Steven<br />SCJP, SCEA
Gabriel Fox
Ranch Hand

Joined: Oct 17, 2001
Posts: 170
Cheers guys for the reference.
I agree. Here's the link:
subject: Creating a WAR file ......
It's not a secret anymore!