Let's say I have 5 applets on the same page. How does the JVM respond to that? Will a new implementation be created for each applet, or does each applet share the jvm? Also, is there some priority, like the first applet added will be the first loaded?

Hope that made sense.

For applets a single VM will typically run all of them for a single INSTANCE of the browser executable (though one could theoretically create a browser that instantiates a new JVM for each applet instance such is AFAIK never done in practice).

The applets will exist in the JVM as separate instances of the same class within a single application space, therefore any static data will be shared between all instances.
This holds true if you have multiple browser windows open, as long as these were created to exist within a single instance of the browser executable.

You should get superior performance as the JVM and classes are loaded only once instead of being loaded for each applet instance separately.

Of course if your applet uses a LOT of instance specific resources you can get into problems with the available memory to the JVM but that's usually a sign of poor design of the applet more than anything else.

Hi everyone,

This is an interesting topic.

jwenting if a single vm runs all the applets on a single html page then what about apllications? Does it also use the same jvm to run another application or is another instance of that program created

Richard West

Hi everyone,

This is an interesting topic.

jwenting if a single vm runs all the applets on a single html page then what about apllications? Does it also use the same jvm to run another application or is another instance of that program created

Richard West

No, each application gets its own instance of the JVM.

There are ways of getting the applications to talk to one another, but that is a different topic.

Regards,

Nate

You could of course create a launcher which starts several applications inside a single JVM, but they'd for the JVM all be the same application which would likely play hell on things like Swing user interfaces.

This article has been dead for over six months. Start a new discussion instead.