The APPLET Element

Applets are embedded in web pages using the <APPLET> and </APPLET> tags. The
APPLET element is similar to the IMG element. Like IMGAPPLET references a source file that is not part of
the HTML page on which it is embedded. IMG elements do
this with the SRC attribute. APPLET
elements do this with the CODE attribute. The CODE attribute tells the browser where to look for the
compiled .class file. It is relative to the location of the source
document. Thus if you're browsing
http://www.ibiblio.org/javafaq/index.html and that page references
an applet with CODE="Animation", then the file
Animation.class should be at the URL
http://www.ibiblio.org/javafaq/Animation.class.

If
the applet resides somewhere other than the same directory as the
page it lives on, you don't just give a URL to its location. Rather
you point at the CODEBASE. The CODEBASE
attribute contains a URL that points at the directory where the .class
file is. The CODE attribute is the name of the .class
file itself. For instance if on the HTML page of the previous
section you had written

then the browser would try to retrieve the applet from
http://www.foo.bar.com/classes/HelloWorldApplet.class regardless of
where the HTML page was.

In short the applet viewer will try to retrieve the applet from
the URL given by the formula (CODEBASE + "/" + code). Once this URL
is formed all the usual rules about relative and absolute URLs
apply.

If the applet is in a non-default package, then the full package
qualified name must be used. For example,