User Tools

Site Tools


how_to_jar_a_file_s

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

  1. 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


  2. 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 or Return key.


    • For packaging multiple files, put a space between the filenameX lines.


    • 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.


how_to_jar_a_file_s.txt · Last modified: 2013/07/25 11:10 by jhuber