The most common command to make a new jar file users the following syntax:
Jar cvf JARFileName File1 File2...
Jar cvfm jarname manifest.mf class1 class2
The option:
-c create new archive file
-t list archive file
-x Extract the archived specified (or all) files
-u update an existing jar file
-v In the standard output to generate verbose output
-f Specify the archive file name
-m The list of files that contain a specified list of information
-e Bundled into the executable jar file for the separate applications
Specify the application entry point
-0 Only storage; do not use any ZIP compression
-M Does not create entries in the list of documents
-i generate index info for Specify a jar file
-C update to specify dictionary and content it file
The Manifest:
Is called MANIFEST.MF and is located in a special META-INF subdirectory of the jar file
The minimum legal manifest is quite boring –just Manifest-Version: 1.0
Complex manifests can have many more entries. The manifest entries are grouped into sections . the first ection in the manifest is calld the main section. It applies to the whole JAR fiile .Subsequent entries can specify properties of named entites such as in dividual files ,package ,or URLs. Those entries must begin with a Name entry.Seciton are separated by blank lines.For example:
Manifest-Version: 1.0
Lines describing this archive
Name:Woozle.class
Lines describing this file
Sealing
The manifest like this:
Name: aken/xml/
Sealed: true
Name: aken1/xml/
Sealed: false
Packaging Beans in JAR Files
Pattern:
Manifest-Version: 1.0
Name: com/horstmann/corejava/ImageViewerBean.class
Java-Bean: True
We place our example beans into the package com.horstmann.corejava because some builder environments have problems loading beans from the default package.
If your bean contains multiple class files, you just mention in the manifest those class files that are beans and that you want to have displayed in the toolbox. For example, you could place ImageViewerBean and FileNameBean into the same JAR file and use the manifest
Manifest-Version: 1.0
Name: com/horstmann/corejava/ImageViewerBean.class
Java-Bean: True
Name: com/horstmann/corejava/FileNameBean.class
Java-Bean: True
Make sure that there are no spaces after the ends of each line, that there are blank lines after the version and between bean entries, and that the last line ends in a newline.