my dog learned polymorphism
The moose likes Servlets and the fly likes how to create WAR files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to create WAR files" Watch "how to create WAR files" New topic

how to create WAR files

Sreedhar mar
Ranch Hand

Joined: Sep 15, 2003
Posts: 34
i hava no idea about WAR files.How to create WAR files .What are the files or directorys need to crate it.
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2591

Have a look at this link, it explains WAR quite well -
- Manish
Gayathri Prasad
Ranch Hand

Joined: Jun 25, 2003
Posts: 116
Hi ,
You need to have RI to see some code in action for link given by Manish.Its lot better to have RI and check for urself some code in action.So if u dont have the RI download it from the Sun site.WAR stands for Web ARchive and essentially this is very similar to JAR but when we pack together the web components, the WAR is an appropriate term .

Prasanna Kumar R.V
Tina Williams

Joined: Sep 10, 2003
Posts: 5
What do you mean by RI?
Idly Vada
Ranch Hand

Joined: Sep 02, 2003
Posts: 135
Originally posted by Tina Williams:
What do you mean by RI?

J2EE Reference Implementation.
This comes along with Sun J2EE SDK
Jithesh Kozhipurath
Ranch Hand

Joined: Aug 27, 2003
Posts: 76
War stands for web archive. U can copy the file to ur web server root directory. so that it will extract automatically to the root folder and u can simply rum that from there.
But What is this RI?

Jithesh K
Malhar Barai
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
Hi all...
This confusion about RI...well Sun has 2 containers to run J2EE application
1. J2EE Reference Implementation(J2EE RI)
2. Sun One Application Server(SoAS)
This one is for pc's having <128MB RAM on Win 2k or Win98,Win Me.

This is for systems running Win2k with >128 MB RAM.
Copy of J2EE SDK
[ September 17, 2003: Message edited by: Malhar Barai ]

Malhar Barai
SOA & Java Book
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63862

I'm not sure what Gayathri is taking about: you do not need any implementation of J2EE in order to create a war file.
You can create it by hand using any zip tool as long as you make sure that the folder structure within the zip file follows the war file format.
The best way that I've found to create them (as well as manage all other build operations) is using Apache Ant.
Now, when it comes time to deploy the war file, of course you need a Servlet/JSP engine. Any spec-compliant engine will do (I favor Jakarta Tomcat and Caucho Resin myself).
[ September 17, 2003: Message edited by: Bear Bibeault ]

[Asking smart questions] [About Bear] [Books by Bear]
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
And if you want to learn about how to use Ant to make deployable war files you might consider reading my recent series of articles on making web applications in the Java Ranch Newsletter.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
ramdas pradeep kumar
Ranch Hand

Joined: Aug 27, 2003
Posts: 36
I've installed apache-ant.
while executing ant command i got:
Out of environment space
Out of environment space
Out of environment space
Out of environment space
Bad command or file name
please help
Jason Davies

Joined: Sep 18, 2003
Posts: 14
A .war file simply contains your web application structure.
You should have a directory something like this:
Then create the .war file using
Read the tutorial links mentioned above for more detail, but the basics are pretty simple.

<a href="" target="_blank" rel="nofollow"></a> - Web programming articles and tutorials.
ramdas pradeep kumar
Ranch Hand

Joined: Aug 27, 2003
Posts: 36
is ant is a tool for creating war files?
will ant create xml,web-inf... all these atomatically.?
Jason Davies

Joined: Sep 18, 2003
Posts: 14
Ant is a Java build tool, similar to make. Ant can be used to create WAR files, only if you have the correct entries in the Ant build.xml configuration file.
In fact you can just use the jar task in one of your targets like this:

The directory structures can also be automatically created. Perhaps you would use something like the following:

Ant is very powerful and can be used for all sorts of things to save you time.
I agree. Here's the link:
subject: how to create WAR files
It's not a secret anymore!