Skip to Main Content
Java Cookbook
book

Java Cookbook

by Ian F. Darwin
June 2001
Intermediate to advanced content levelIntermediate to advanced
888 pages
21h 1m
English
O'Reilly Media, Inc.
Content preview from Java Cookbook

Running an Applet from a JAR

Problem

You want to optimize downloading time for an applet by putting all the class files into one JAR file.

Solution

jar the applet and supporting files. Deploy the JAR file in place of the class file on the web server. Use <APPLET CODE="MyClass" ARCHIVE="MyAppletJar.jar" ...>.

Discussion

Once you’ve deployed the JAR file on the web server in place of the class file, you only need to refer to it in the APPLET tag in the HTML. The syntax for doing this is to use an ARCHIVE="name of jar file" attribute on the APPLET tag.

See Also

You can also store other resources such as GIF images for use by the applet. You then need to use getResource( ) instead of trying to open the file directly; see Step 5 in Section 23.12.

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.
Start your free trial

You might also like

Practical Cloud-Native Java Development with MicroProfile

Practical Cloud-Native Java Development with MicroProfile

Emily Jiang, Andrew McCright, John Alcorn, David Chan, Alasdair Nottingham
Distributed Computing in Java 9

Distributed Computing in Java 9

Raja Malleswara Rao Malleswara Rao Pattamsetti

Publisher Resources

ISBN: 0596001703Supplemental ContentCatalog PageErrata