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 manifest.mf .
Listing 4-4. manifest.mf 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 manifest.mf logging/*.class
ThiscommandlinecreatesaJARfilenamed logging.jar (viathe c [create]and
f [file] options). It also merges the contents of manifest.mf (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-
tp://download.oracle.com/javase/7/docs/technotes/guides/
jar/jar.html#JAR Manifest ) .
Assuming that the jar tool presents no error messages, execute the following
Windows-orientedcommandline(oracommandlinesuitableforyourplatform)torun
PackageInfo and extract the package information from the logging package:
Search WWH ::




Custom Search