Home Segments Top Top Previous Next

1067: Mainline

Once you have a manifest file, say manifest.txt, then you can create a JAR file using the command-line jar program. Suppose, for example, that your current directory contains all the class files needed by your movie application program. Then, you can create a JAR file by typing the following:

 *-- Command 
 |         *-- Manifest file 
 |         |            *-- JAR file produced 
 |         |            |                    *-- Included class files 
 |         |            |                    | 
 v         v            v                    v 
jar -cmf manifest.txt MovieApplication.jar *.class 
     --- 
      ^ 
      *-- c means create a new JAR file 
          m means use the following manifest file 
          f means use the file name supplied 

You can use wildcards to identify a collection of files, as shown. Alternatively, you can supply a list of explicit file names, separated by spaces.