December 1999
Intermediate to advanced
816 pages
20h 27m
English
This chapter provides a quick reference for java.util.jar, which supports creating and manipulating a jar file programmatically. Using a jar file outside of a program is simple. You can create it like this:
jar cf MyJar.jar *.class *.gif
in which jar says to run the jar command. The cf flags tell the jar command to create a jar file (c is for create, and f is for file). MyJar.jar is the name of the jar file to create. This is followed by the list of files to put into the jar file. In this case, it is all Java class files and all the .gif files in the current directory.
A jar file is a Java platform-neutral version of a PKWare zip file. You can extract the contents of a jar file by typing this:
jar xvf MyJar.jar
Read now
Unlock full access