|Java menu knowledge base|
Speed Issues: using compressed CAB and JAR files
Applets can be compressed to get them to download faster. You may be used to using ZIP files
to make many kinds of file smaller. CAB and JAR files are just
the same thing. CAB is a Microsoft-only compression format
used for many file types, including applets. JAR is a Rest-Of-The-World-only format
used for applets. As around 90% of web users use Microsoft, CAB is the
most important format. A single webpage and a single APPLET tag can
support both CAB and JAR formats, so there is no compatibility problem.
Although you can theoretically make your own CAB and JAR files
just by compressing our applets, many people may find this difficult
or may not have the right software. With many of our applets we now supply
CAB and JAR files as well to save you the trouble.
CAB and JAR generally achieve compression rates of about 45% on
applets. That means: the applets are almost half the size afterwards.
How do I deploy CAB and JAR files?
Let's take an example of a single-file applet called "myApplet.class".
If you are supplied with CAB and JAR files for this, you will also
find files called "myApplet.jar" and "myApplet.cab" in the delivery
pack. You need ALL THREE FILES!
Here are the things you do to deploy the compressed files:
- You need the CAB file for Microsoft browsers
- You need the JAR file for other browsers
- You need the (uncompressed) CLASS file for really old browsers
- Upload all the files to the server (all of them)
- Don't change the APPLET tag
- Add this parameter <PARAM NAME=cabbase VALUE="myApplet.cab"> for the CAB file
- Add this parameter <PARAM NAME=archive VALUE="myApplet.jar"> for the JAR file
- If your applet then starts failing in a browser-specific manner, remember
that you are now using different files for different browsers, so that one damaged
or missing file will have browser-specific consequences.