Home : Course Map : Chapter 5 : Java :
Applet Sub-directory
JavaTech
Course Map
Chapter 5
File/Package/Import
  Demo 1
  Demo 2
Access/Visibility
final & Constants
Static Import
Jar Files
  Demo 3
Applet Directories
3rd Party Packages
CLASSPATH
javadoc
CodingConventions
Exercises

    Supplements
Scope
Debug Techniques
Java Runtime
Class Class
JVM Instructions 2
JVM Processing
pack200

     About JavaTech
     Codes List
     Exercises
     Feedback
     References
     Resources
     Tips
     Topic Index
     Course Guide
     What's New

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

     <applet
     code="simpleApplet.class"
     codebase="../../Code/Java/Beginners/HelloWorld/"
     width="100" height="100">
  </applet>

Finally, it is possible for the code to reside at a completely different URL address such as in this example:

  <applet
   code="HelloWorld.class"
   codebase = "http://xyz.com/Course/Code/Java/Beginners/HelloWorld/"
   width="100" height="100">
  </applet>

References and Web Resources

Last update: Oct.24, 2004

            Tech
DecimalFormat
  Demo 1
  Demo 2

System.out.printf
  Demo 3
CJ Format Class
  Demo 4   Demo 5
Other Format Tools

Immutable Complex
Exercises

           Physics
Interpolation
Integration
  Demo 1
Simpson Rule
  Demo 2
Exercises

  Part I Part II Part III
Java Core 1  2  3  4  5  6  7  8  9  10  11  12 13 14 15 16 17
18 19 20
21
22 23 24
Supplements

1  2  3  4  5  6  7  8  9  10  11  12

Tech 1  2  3  4  5  6  7  8  9  10  11  12
Physics 1  2  3  4  5  6  7  8  9  10  11  12

Java is a trademark of Sun Microsystems, Inc.