This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is a .war file?

 
Zac Roberts
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Hema Menon
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Kyle Shapiro
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to make a war file? Is there a similar command such as war, like jar for making jar files?
 
Garann Means
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kyle,
I'm pretty sure you just jar it up, but specify the extension of the output file as .war.
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Garann is correct.
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As they're similar to .jar files, can WinZip open and extract .war files without problem?
Thanks,
Corey
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. The compression method is the same. The only difference is the file extension.
 
Meena Samba
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic