Java Reference
In-Depth Information
Working with JAR files (continued)
Figure 14.18
All files in the .\com directory are added to jeopardy.jar.
The jeopardy.jar now contains all the files necessary to run the Jeopardy application. The
program can be executed with the following command:
java -jar jeopardy.jar
There are 11 .class files in the archive jeopardy.jar, but the JVM knows which one con-
tains the main() method by checking the Main-Class entry of the manifest file.
JAR Files and Applets
An applet can place the files it needs in an archive , a single, compressed file
containing bytecode, images, sound files, and any other files that the applet
needs. Archive files simplify the task of an applet trying to locate other files,
and also improves performance of downloading, since the files are com-
pressed using the same compression format as ZIP files.
You can open JAR files to view their contents by using the standard ZIP
utility programs such as WinZip or PKUnzip.
The archive is typically a JAR file, or Java Archive, although ZIP files can
also be used. The jar tool that comes with the J2SDK is used to create JAR files.
With applets, you can place all the necessary bytecode and other files needed
by the applet in the JAR file.
Search WWH ::




Custom Search