I have a web program where I want the user to be able to import a .war
file and I can extract certain files out of the .war
file. I have found two class libraries: java.util.zip.*
and java.util.jar.*
. From what I understand, a WAR file is a special JAR file which is a special ZIP file. So would it be better to use java.util.jar
? If ZIP and JAR files are pretty much the same why is there a need for two different libraries?
WAR file is just a JAR file, to extract it, just issue following jar command –
jar -xvf yourWARfileName.war
If the jar command is not found, which sometimes happens in the Windows command prompt, then specify full path i.e. in my case it is,
c:\java\jdk-1.7.0\bin\jar -xvf my-file.war