Packaging Your Applet
After
you have written your applet, you’ll want to combine its class
files with those from the appropriate Oracle
classesXXX.zip file into a single zip or jar
file as you did for Example 3-1. This step is
necessary because an applet using JDBC is naturally quite complex and
contains many classes. Getting to just one file makes things easier
to manage. It is also simpler and more efficient to specify just one
file in the HTML APPLET tag rather than specify multiple archive
files.
Tip
For simplicity’s sake, this discussion on packaging focuses on the use of JDK 1.2. If you are using JDK 1.1, the syntax for using the jar tool to create the jar file will be slightly different. If you use WinZip, the procedure will be the same as it is for JDK 1.2.
A Development Packaging Cycle
During the development stage for an applet, you can begin your
packaging effort by simply making a copy of the Oracle
classes12.zip file. Give it the name of your
archive file but retain the
.zip
extension. Then add your applet’s
class files, uncompressed, to the zip file that you just copied and
renamed. Why uncompressed? I actually don’t know. This is an
Oracle recommendation. I have used them as compressed class files
when I have created a jar file, but I have never done so using a zip
file. For example, if you’re going to create a zip file for an
applet named TestAppletPolicy, you should follow
these steps:
Copy the file
classes12.ziptoTestAppletPolicy.zip. On a Windows system, you can ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access