In J2EE web development, Web Application Archive(WAR) file is just a normal JAR file, which consists all of your web application components like, servlets, Java classes, libraries, resources and etc. Read Wiki for detail.

Problem

Current web application WAR file is generated via Ant or Maven tool, copy to *nix environment for deployment, but no idea how to extract the WAR file?

Solution

WAR file is just a JAR file, to extract it, just issue following jar command – “jar -xvf yourWARfileName.war“.

See output…

#jar -xvf mkyongApp.war
 
  created: WEB-INF/
  created: WEB-INF/classes/
  created: WEB-INF/classes/META-INF/
  created: WEB-INF/classes/com/
  created: WEB-INF/classes/com/mkyong/
  ......
extracted: WEB-INF/classes/applicationContext-mail.xml
extracted: WEB-INF/classes/com/mkyong/batch/batchProcessor.class
  ......
Note
In most application server like GlassFish, JBoss or web container like Tomcat, you don’t need to extra the “WAR” file, just copy to correct folder, and it will extract by the deployed server during start up.
Tags :
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.
My website mkyong.com is hosted by Liquid Web, I really like their fast and helpful support, it saved me a lot of time. Furthermore, their servers are extremely reliable, fast and stable, I don't remember when was the last time we had server downtime. Btw, they're offering $100 Coupon now, if you are sourcing for great hosting provider, go grab it.

Related Posts

Popular Posts