How to Jar a File(s)
To JAR files and folders requires the use of Windows Command Prompt (Windows) or Terminal/Shell (Mac & Linux).
The screenshots below are from Windows Command Prompt, but the java commands will look the same whether using Windows, Mac, Linux, or remote terminals such as PuTTY.
For more in-depth tutorials on JAR files visit http://docs.oracle.com/javase/tutorial/deployment/jar/index.html
Change the working directory to the location in which the file(s) you wish to JAR is contained. For the screenshot below, for example, the working directy was e:\csci wiki\java
Type jar cf jarfilename filenameX
, where jarfilename
is the name of the new JAR file with the .jar
extension to be created and filenameX
is the name of the file to be packaged, and press the Enter
For packaging multiple files, put a space between the filenameX
To package all
files in the directory use *.
To package a folder, be sure you are in the directory prior
to the folder to be JARed and use the folder name instead of a file name.