Java Reference
In-Depth Information
from isCompatibleWith() becausethe logging packagedoesnotcontainaspe-
cification version number in dotted form (it is null).
Perhaps the simplest way to place package information into the logging package
istocreatea logging.jar fileinasimilarmannertotheexampleshownin Chapter
3 . Butfirst,youmustcreateasmalltextfilethatcontainsthepackageinformation.You
can choose any name for the file. Listing 4-4 reveals my choice of .
Listing 4-4. containing the package information
Implementation-Title: Logging Implementation
Implementation-Vendor: Jeff Friesen
Implementation-Version: 1.0a
Specification-Title: Logging Specification
Specification-Vendor: Jeff Friesen
Specification-Version: 1.0
Sealed: true
Note MakesuretopresstheReturn/Enterkeyattheendofthefinalline( Sealed:
true ).Otherwise,youwillprobablyobserve Sealed: false intheoutputbecause
thisentrywillnotbestoredinthe logging packagebytheJDK's jar tool— jar is
a bit quirky.
ExecutethefollowingcommandlinetocreateaJARfilethatincludes logging and
itsfiles,andwhose manifest ,aspecialfilenamed MANIFEST.MF thatstoresinforma-
tion about the contents of a JAR file, contains the contents of Listing 4-4 :
jar cfm logging.jar logging/*.class
ThiscommandlinecreatesaJARfilenamed logging.jar (viathe c [create]and
f [file] options). It also merges the contents of (via the m [manifest]
option) into MANIFEST.MF , which is stored in the package's META-INF directory.
Note To learn more about a JAR file's manifest, read the “JAR Manifest” section
of the JDK documentation's “JAR File Specification” page ( ht-
jar/jar.html#JAR Manifest ) .
Assuming that the jar tool presents no error messages, execute the following
PackageInfo and extract the package information from the logging package:
Search WWH ::

Custom Search