How to extract .war files in java? ZIP vs JAR
问题 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? 回答1: If you look at the JarFile API you'll see that it's a subclass