Java Programing

June 20, 2007

Because we requested verbose output, jar tells us

Filed under: Java Programming — webmaster @ 1:36 pm

Because we requested verbose output, jar tells us what it is doing: adding:spaceblaster/ (in=0) (out=0) (stored 0%) adding:spaceblaster/game/ (in=0) (out=0) (stored 0%) adding:spaceblaster/game/Game.class (in=8035) (out=3936) (deflated 51%) adding:spaceblaster/game/Planetoid.class (in=6254) (out=3288) (deflated 47%) adding:spaceblaster/game/SpaceShip.class (in=2295) (out=1280) (deflated 44%) adding:spaceblaster/images/ (in=0) (out=0) (stored 0%) adding:spaceblaster/images/spaceship.gif (in=6174) (out=5936) (deflated 3%) adding:spaceblaster/images/planetoid.gif (in=23444) (out=23454) (deflated 0%) adding:spaceblaster/docs/ (in=0) (out=0) (stored 0%) adding:spaceblaster/docs/help1.html (in=3592) (out=1545) (deflated 56%) adding:spaceblaster/docs/help2.html (in=3148) (out=1535) (deflated 51%) jar creates the file spaceblaster.jar and adds the directory spaceblaster, in turn adding the directories and files within spaceblaster to the archive. In verbose mode, jar reports the savings gained by compressing the files in the archive. We can unpack the archive with this command: % jar xvf spaceblaster.jar Likewise, we can extract an individual file or directory with: % jar xvf spaceblaster.jar filename But you normally don’t have to unpack a JAR file to use its contents; Java tools know how to extract files from archives automatically. We can list the contents of our JAR with the command: % jar tvf spaceblaster.jar Here’s the output; it lists all the files, their sizes, and creation times: 0 Thu May 15 12:18:54 PDT 1997 META-INF/ 1074 Thu May 15 12:18:54 PDT 1997 META-INF/MANIFEST.MF 0 Thu May 15 12:09:24 PDT 1997 spaceblaster/ 0 Thu May 15 11:59:32 PDT 1997 spaceblaster/game/ 8035 Thu May 15 12:14:08 PDT 1997 spaceblaster/game/Game.class 6254 Thu May 15 12:15:18 PDT 1997 spaceblaster/game/Planetoid.class 2295 Thu May 15 12:15:26 PDT 1997 spaceblaster/game/SpaceShip.class 0 Thu May 15 12:17:00 PDT 1997 spaceblaster/images/ 6174 Thu May 15 12:16:54 PDT 1997 spaceblaster/images/spaceship.gif 23444 Thu May 15 12:16:58 PDT 1997 spaceblaster/images/planetoid.gif 0 Thu May 15 12:10:02 PDT 1997 spaceblaster/docs/ 3592 Thu May 15 12:10:16 PDT 1997 spaceblaster/docs/help1.html 3148 Thu May 15 12:10:02 PDT 1997 spaceblaster/docs/help2.html 3.5.2.1 JAR manifests Note that jar adds a directory called META-INF to our archive. It contains one file: MANIFEST.MF. The META-INF directory holds files describing the contents of the JAR file. The MANIFEST.MF file that jar adds is an automatically generated packing list naming the files in the archive along with cryptographic checksums for each. The manifest is a text file containing a set of lines in the form keyword: value. The format of the manifest file changed between SDK 1.1 and SDK 1.2. In SDK 1.2 and later, the manifest file is very simple, containing no information on the items in the archive: - 63

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URI

Sorry, the comment form is closed at this time.

Powered by Java Web Hosting