To examine your handiwork, you can use the
option to list the contents of a JAR.
Again, we use the
-f option to specify the JAR
name. As before, the
-v option is also available.
jar -tvf GraphLayout.jar948 Tue Jun 03 15:29:48 EDT 1997 META-INF/MANIFEST.MF 316 Wed Sep 18 12:16:52 EDT 1996 Edge.class 3059 Wed Sep 18 12:16:52 EDT 1996 Graph.class 5986 Wed Sep 18 12:16:54 EDT 1996 GraphPanel.class 375 Wed Sep 18 12:16:54 EDT 1996 Node.class 0 Wed Apr 16 08:28:38 EDT 1997 audio/ 21745 Wed Sep 18 12:16:56 EDT 1996 audio/computer.au 759 Wed Sep 18 12:16:56 EDT 1996 audio/drip.au 42068 Wed Sep 18 12:16:56 EDT 1996 audio/gong.au
But wait a minute! What is META-INF/MANIFEST.MF? It’s the manifest file, a special file that contains information about the rest of the JAR. I’ll talk about it soon.
To extract files from a JAR, use the
options are available, as before. You can
extract all the files or just specify a few, as we do here:
jar -xvf GraphLayout.jar Edge.class audioextracted: Edge.class created: audio\ extracted: audio\computer.au extracted: audio\drip.au extracted: audio\gong.au
jar automatically recreates
On the Win32 platform, you may have to reverse some of the slashes. For example, to extract just the computer.au file in the audio subdirectory, you would do this:
jar -xvf GraphLayout.jar audio\computer.auextracted: audio\computer.au
Even though a contents listing (using
) shows this file as ...