Nikolay Kuznetsov
Nikolay Kuznetsov

Reputation: 9579

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?

Upvotes: 0

Views: 1308

Answers (2)

Nikolay Kuznetsov
Nikolay Kuznetsov

Reputation: 9579

This is to answer my own question from Java Console:

CacheEntry[http://localhost/applet/MyApplet.jar]: updateAvailable=true,lastModified=Tue Jan 08 16:10:19 KST 2013,length=2128455
network: Connecting http://localhost/applet/MyApplet.jar with proxy=DIRECT
network: Connecting http://localhost:80/ with proxy=DIRECT
network: Downloading resource: http://localhost/applet/MyApplet.jar
    Content-Length: 2,128,450
    Content-Encoding: null

network: Wrote URL http://localhost/applet/MyApplet.jar to File C:\Users\Nikolay\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\0\1367c940-4740e460-temp
security: The jar file isnt signed so the blacklist check will be skipped
security: Trusted libraries list file not found

cache: Replacing MemoryCache entry (cnt=0) for http://localhost/applet/MyApplet.jarwas=com.sun.deploy.cache.CacheEntry (749595) now=com.sun.deploy.cache.CacheEntry (15535897)
basic: Applet loaded.
basic: Applet resized and added to parent container
basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 1039162 us, pluginInit dt 903077 us, TotalTime: 1942239 us

Upvotes: 0

Andrew Thompson
Andrew Thompson

Reputation: 168845

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.

Upvotes: 1

Related Questions