• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why to extract war file?

 
smitha rajgopal
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I was asked this question in an interview.Why should we create a war and extract the war to webapps.Why not copy the folder directly and run.Please le t me know the answer

Thanks,
Smitha
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For easier distribution - it's just a single file to copy. We have a web app that has more than 34000 files; copying those over the network would take a long time.

It's also more orderly to initialize. The servlet engine knwos what to do with a war file, while if you copy individual files, it might try to start initializing the web app as soon as it sees the web.xml file, which may be too soon (because some files are still missing).
 
Imran Jack
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can we extract war file ??? I had tried winRAR, on right-click it give options to further compress it and does not have options like extract etc.
 
Imran Jack
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
eureka,
>jar -xvf struts2-mailreader.1.1.war
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need to extract them.
Tomcat will do it automatically.

Simply drop your war file in the tomcat/webapps directory and Tomcat will take care of the rest.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic