For organizational purposes it is often convenient to put applet
files in separate sub-directories from the hypertext page that
includes it.
For example, say that we want the Demo1.html
hypertext page in the myApplets
directory
myApplets/simpleApplet.html
to use an applet class file located in a sub-directory
myApplets/Beginners/HelloWorld/simpleApplet.class
Then the tag will be
<applet
code="simpleApplet.class"
codebase="Beginners/HelloWorld/"
width="100" height="100">
</applet>
Note that the following tag will NOT
work:
<applet
code="basic/demo/simpleApplet.class"
***
ERROR ***
width="100" height="100">
</applet>
The sub-directory references can also go above these directories
as long as they don't go outside limits imposed by the web server
and browser security manager.
That is, suppose that the class file is in
Course/Code/Java/Beginners/HelloWorld/
and the hypertext file is in
Course/Java/Chapter01/simpleApplet.class
then use
Finally, it is possible for the code to reside at
a completely different URL address such as in this example: