分类: Java
2011-06-14 04:57:08
The name of the class that set as the application entry point for stand-alone applications bundled into executable jar file. The -e option and entrypoint are a pair -- if either is present, they must both appear. The letters m, f and e must appear in the same order that manifest, jarfile, entrypoint appear.
Temporarily changes directories to dir while processing the following inputfiles argument. Multiple -C dir inputfiles sets are allowed.
Sets as the application entry point for stand-alone applications bundled into executable jar file. The use of this option creates or overrides the Main-Class attribute value in the manifest file. This option can be used during creation of jar file or while updating the jar file. This option specifies the application entry point without editing or creating the manifest file.
For example, this command creates Main.jar where the Main-Class attribute value in the manifest is set to Main:jar cfe Main.jar Main Main.classThe java runtime can directly invoke this application by running the following command:
java -jar Main.jarIf the entrypoint class name is in a package it may use either a dot (".") or slash ("/") character as the delimiter. For example, if Main.class is in a package called foo the entry point can be specified in the following ways:jar -cfe Main.jar foo/Main foo/Main.classorjar -cfe Main.jar foo.Main foo/Main.classNote: specifying both -m and -e options together when the given manifest also contains the Main-Class attribute results in an ambigous Main.class specification, leading to an error and the jar creation or update operation is aborted.
Temporarily changes directories (cd dir) during execution of the jar command while processing the following inputfiles argument. Its operation is intended to be similar to the -C option of the UNIX tar utility. For example:jar uf foo.jar -C classes bar.classchanges to the classes directory and add the bar.class from that directory to foo.jar. The following command,jar uf foo.jar -C classes . -C bin xyz.class (我的注:-C dir file(s) -C dir file(s)changes to the classes directory and adds to foo.jar all files within the classes directory (without creating a classes directory in the jar file), then changes back to the original directory before changing to the bin directory to add xyz.class to foo.jar. If classes holds files bar1 and bar2, then here's what the jar file contains using jar tf foo.jar:META-INF/
META-INF/MANIFEST.MF
bar1
bar2
xyz.class