aspose file tools*
The moose likes Servlets and the fly likes What is a .war file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "What is a .war file? " Watch "What is a .war file? " New topic
Author

What is a .war file?

Zac Roberts
Ranch Hand

Joined: Jan 29, 2002
Posts: 82
Could anybody give me a quick description of a .war file and why it is useful. I know I should just look it up myself but I like to get people's opinions on the usefulness of this stuff...
Thanks
Zac


Zac Roberts<br />SCJP2
Hema Menon
Ranch Hand

Joined: Oct 29, 2000
Posts: 569
WAR files are similar to jars, wherein they package all the resources.
Check out this link
http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/WebComponents3.html
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

WAR file is a "Web Application Archive" -- it's comprised of all the pieces of your web application: JSPs, Servlets, Images, Static HTML, images, etc. -- and all packaged in a single snazzy little file.
Couple great advantages of a WAR file -->
1- Easily transferred from development to production machines (there aren't TONS of files to move and make sure they're all in the right order).
2- They're self describing -- it contains a deployment descriptor (web.xml) that tells the app server exactly what's in it and how its run.
3- It's standards based -- so you can (in theory) deploy this one WAR file onto ANY app server Vendor (HP, BEA, IBM etc).


- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
Kyle Shapiro
Greenhorn

Joined: Mar 19, 2002
Posts: 2
How to make a war file? Is there a similar command such as war, like jar for making jar files?
Garann Means
Ranch Hand

Joined: Jan 28, 2002
Posts: 214
Kyle,
I'm pretty sure you just jar it up, but specify the extension of the output file as .war.
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
Garann is correct.


Matthew Phillips
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

yup -- simply use the jar command but specify the name of the output file as something.war rather than .jar.
Also, there are some utilities out there that will help you to create WAR files and the deployment descriptors that go with them.
You can check out HP RadPak, it comes with the HP-Application Server. It also gives you the ability to look inside and even edit the contents of JAR/WAR files without exploding them.
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
As they're similar to .jar files, can WinZip open and extract .war files without problem?
Thanks,
Corey


SCJP Tipline, etc.
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
Yes. The compression method is the same. The only difference is the file extension.
Meena Samba
Greenhorn

Joined: May 10, 2002
Posts: 1
Can you please explain .ear files? the steps to create an .ear file, the usage it is subjected to and the difference between .ear and .war files?
Thanks in advance.
[ May 21, 2002: Message edited by: Meena Samba ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is a .war file?
 
Similar Threads
war file
WLS8.1 serving old jsp pages after installing new ear file
Problem with contextPath
JSF issue with JBoss
WAR file update through program