"jar -xvf" Command to Extract Files from a JAR

Q

What is the "jar" command to extract all files from a JAR file?

✍: FYIcenter.com

A

To extract all files in a JAR file, you can use the "jar -xvf" command. For example:

\fyicenter>"%java_home%\bin\jar" -xvf jms.jar
  created: META-INF/
 inflated: META-INF/MANIFEST.MF
  created: javax/
  created: javax/jms/
 inflated: javax/jms/BytesMessage.class
 inflated: javax/jms/Connection.class
 inflated: javax/jms/ConnectionConsumer.class
 inflated: javax/jms/ConnectionFactory.class
 inflated: javax/jms/ConnectionMetaData.class
           ...

\fyicenter>dir 
   <DIR>          .
   <DIR>          ..
   <DIR>          javax
          26,257 jms.jar
   <DIR>          META-INF

Note that the "v" option generated verbose output on your screen.

Back to FAQ for JDK JAR (Java ARchive) Tool.

2015-11-07, 2254👍, 0💬