Book Excerpt Index
Updating a JAR File
The Jar tool in version 1.2 of the JavaTM
Development Kit provides a The basic command for adding files has this format: jar uf jar-file input-file(s) In this command:
Any files already in the archive having the same pathname as a file being added will be overwritten.
As when creating a new JAR file, you can
optionally use the
You can combine the jar umf manifest jar-file In this command:
ExamplesRecall thatTicTacToe.jar has these contents:
META-INF/MANIFEST.MF TicTacToe.class audio/ audio/beep.au audio/ding.au audio/return.au audio/yahoo1.au audio/yahoo2.au images/ images/cross.gif images/not.gif
Suppose that you want to add the file jar uf TicTacToe.jar images/new.gif The revised JAR file would have this table of contents: META-INF/MANIFEST.MF TicTacToe.class audio/ audio/beep.au audio/ding.au audio/return.au audio/yahoo1.au audio/yahoo2.au images/ images/cross.gif images/not.gif images/new.gif
You can use the jar uf TicTacToe.jar -C images new.gifThis command would change to the images directory before adding
new.gif to the JAR file. The images directory would not
be included in the pathname of new.gif when it's added to the
archive, resulting in a table of contents that looks like this:
META-INF/MANIFEST.MF TicTacToe.class audio/ audio/beep.au audio/ding.au audio/return.au audio/yahoo1.au audio/yahoo2.au images/ images/cross.gif images/not.gif new.gif
As a final example, suppose you want to modify the default manifest of
Name: TicTacToe.class Implementation-Title: "TicTacToe demo" Implementation-Version: "build57" Implementation-Vendor: "Sun Microsystems, Inc."
If the file containing this information was called jar umf versionInfo TicTacToe.jarAfter running this command, TicTacToe.jar 's manifest would
contain the information from your versionInfo file.
|