Java Reference
In-Depth Information
JAR file and run java against it. With this simple setup, users need not even
know they are using a Java application—it runs like any other application.
5.11.1.1
The only way in which jar really differs from any other ZIP archive utility is
in the automatic creation and use of a manifest file, by default named
META-INF/MANIFEST in the archive. Even if you do not specify a manifest file
of your own, the jar utility creates one for you. Let's take a moment to look at
what goes into the manifest.
A manifest is basically a list of key/value pairs. The key comes at the start
of a line and the value comes at the end of the line with a colon separating the
two. Example 5.21 shows a sample manifest.
The Manifest File
Example 5.21 Manifest from the Payback sample application
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.5.3
Created-By: 1.4.1_02-b06 (Sun Microsystems Inc.)
Version: 1.0
Main-Class: net.multitool.Payback.Payback
All of these entries were produced automatically by ant or the jar utility
itself, except for Main-Class , which we specified (albeit with ant , as you will
see in Chapter 9). The manifest has certain values that are always filled in by
jar , but two that you might commonly specify are
Main-Class , which allows users to run a Java application by merely typ-
ing java someJarFile.jar , without having to know the fully package
qualified name of the class that contains the application's main() .
Class-Path , which allows you to specify what the classpath should be
when the application is run.
There are keys specific to applets, to signed applications, to beans, and so
forth. We will address these as it becomes necessary. Full details can, of course,
be found in the Sun's documentation for jar . 27
27. http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/jar.html
Search WWH ::




Custom Search