News:

Build a stunning handcrafted website with IT Acumens

Main Menu

Applet Directory

Started by sukishan, Jul 15, 2009, 02:14 PM

Previous topic - Next topic

sukishan

By default, a browser looks for an applet's class and archive files in the same directory as the HTML file that has the <APPLET> tag. (If the applet's class is in a package, then the browser uses the package name to construct a directory path underneath the HTML file's directory.) Sometimes, however, it's useful to put the applet's files somewhere else. You can use the CODEBASE attribute to tell the browser in which directory the applet's files are located:
<APPLET CODE=AppletSubclass.class CODEBASE=aURL
        WIDTH=anInt HEIGHT=anInt>
</APPLET>

If aURL is a relative URL, then it's interpreted relative to the HTML document's location. By making aURL an absolute URL, you can load an applet from just about anywhere — even from another HTTP server.
This tutorial uses CODEBASE="someDirectory/" frequently, since we group the examples for each lesson in subdirectories. For example, here's the <APPLET> tag that includes the Simple applet in The Life Cycle of an Applet:


<APPLET CODE=Simple.class CODEBASE="example/"
        WIDTH=500 HEIGHT=20>
</APPLET>
A good beginning makes a good ending