How to use jar

jar is a file-collection program, like tar and zip: It collects together all the contents of a directory into one single file.

jar comes with javac, java, and javadoc in the Java Development Kit. It is available on all the KSU computers---if you can use javac on your computer, then you can use jar.

Say that you have a directory, Direc, that you want to collect together with jar. You can do this

From an MS-DOS command window:

  1. cd to the directory that holds Direc.
  2. type
    jar c Direc  > Direc.jar
    
    This tells jar to collect the contents of Direc into the newly created file, Direc.jar. The file will be created in the same directory where Direc lives.

Given the jar file, Direc.jar, you can open it from the command window:

jar xvf Direc.jar
This will recreate directory Direc and its contents.