Extracting .jar file with command line Extracting .jar file with command line java java

Extracting .jar file with command line


From the docs:

To extract the files from a jar file, use x, as in:

C:\Java> jar xf myFile.jar

To extract only certain files from a jar file, supply their filenames:

C:\Java> jar xf myFile.jar foo bar

The folder where jar is probably isn't C:\Java for you, on my Windows partition it's:

C:\Program Files (x86)\Java\jdk[some_version_here]\bin

Unless the location of jar is in your path environment variable, you'll have to specify the full path/run the program from inside the folder.

EDIT: Here's another article, specifically focussed on extracting JARs: http://docs.oracle.com/javase/tutorial/deployment/jar/unpack.html


Note that a jar file is a Zip file, and any Zip tool (such as 7-Zip) can look inside the jar.


In Ubuntu:

unzip file.jar -d dir_name_where_extracting