Search code examples
javabrowserappletjapplet

How does a browser deal with applets?


I wonder what happens when my browser goes to a web-page like this. When I try to google for "browser" and "applet" mostly it finds how to add applet to browser and troubleshooting, but not how it works.

<html>
<head><title>My Applet</title></head>
<body>
    <applet code="org/mypackage/MainClass.class" archive="MyApplet.jar,libA.jar,libB.jar" width="1600" height="860"></applet>
</body>
</html>

If the web-page is remote then I guess browser has to download all mentioned jars in archive parameter to some temporary folder and then browser asks Java Plugin to process next. So the plugin would find then jar which has MainClass and would start Java program execution.

Is my understanding correct?

My applet requires many external jars, so I have packages only my classes into MyApplet.jar. Then in a separate folder I put

MyApplet.jar
libA.jar
libB.jar
applet.hmtl

And double click applet.html

In manifest for MyApplet.jar there is

Rsrc-Class-Path: ./ libA.jar libB.jar
Class-Path: .

Is it really necessary to put these line in manifest?


Solution

  • Is my understanding correct?

    Basically, barring an applet deployed using Java Web Start and lazily downloading the library Jars either depending on need, or programmatically.

    Is it really necessary to put these line in manifest?

    If the Jars are as follows they do not need to be referenced in the manifest.

    • Listed in the archive attribute of the applet element.
    • Listed in the resources section of the JNLP as a jar element.