aspose file tools*
The moose likes Java in General and the fly likes Packing and Unpacking WAR files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Packing and Unpacking WAR files" Watch "Packing and Unpacking WAR files" New topic
Author

Packing and Unpacking WAR files

Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
Hello, Can anyone tell me how to do this.
i've placed the files I want in one folder and I've typed in the command line :
jar cvf test.war ServletSimplePublisher.java ServletSimplePublisher.class SimplePublisher.html web.xml
is it correct to copy all files you r gonna pack in a folder and then jar it?
Now, I've got a test.war file. How do I unpack it?
thanks


I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

You don't have the correct WAR file structure, your WAR needs to look something like this:

Then to jar it you can type:
jar cvf test.war *
or
jar cvf test.war SimplePublisher.html WEB-INF/web.xml WEB-INF/classes/ServletSimplePublisher.class WEB-INF/src/ServletSimplePublisher.java
There's no need to unpack your WAR file in order to deploy it to your application server. But, if for some odd reason you want to explode the WAR, you can use a program such as WinZip, or you can use the jar tool:
jar xvf test.war
The HP Application Server comes with some great TrailMaps that will introduce you to WAR files, their structure, and how they work. HP-AS also comes with a deployment tool called RadPak that makes creating and deploying WAR files quite easy. -- And better yet, HP-AS is totally free.
[ February 14, 2002: Message edited by: Jessica (Bradley) Sant ]

- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
Mike Monali
Greenhorn

Joined: Feb 15, 2002
Posts: 4
Is it possible to use Apache's ANT for this purpose? Does anyone know how to do this? Thanks!
Steve Fahlbusch
Bartender

Joined: Sep 18, 2000
Posts: 556
    
    7

Ant can be used to copy files, make directories, complile source, run tests, pack into jars, wars
and ears.
I you want a detailed intro to how to get ant
to do all this look at: Java Tools for eXtreme
Programming (Hightower & Lesiecki )
-steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Packing and Unpacking WAR files
 
Similar Threads
HelloWorld.jsp Is Jarred Into a .war File
JBoss Context
How To Jar an Entire Folder?
Folder Structure
Problem in Creating WAR file