How does an applet get loaded into the browser?

Rob Edmondson

The browser’s HTML interpreter reads the parameters from the APPLET tag. The relevant parameters used to load the applet’s class are CODE, CODEBASE, and ARCHIVE (CODEBASE and ARCHIVE are optional - OBJECT can be used instead of CODE). The CODE parameter holds the name of the applet’s class file. The CODEBASE holds the class file directory (the default is the current directory), and the ARCHIVE is the name of a jar or zip file that the applet’s class files are stored in (the default is no archive).

The browser then reads the byte code from the class files and performs a verification pass, checking for access violations and invalid opcodes (among other things). The Java Virtual Machine (JVM) then builds an object for each class (provided the objects have not been created by a previous instance), and executes any static code in each object’s initialization section. Object initialization also includes the construction of the superclass objects (the superclass files from Applet to Object are typically loaded from the browser’s own Java API on the local file system).

If the applet makes it this far without generating security exceptions, missing class errors, or common errors in static code segments, the JVM will make calls to initialization functions in the superclass, then to the applet’s init() member.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact