Skip to content Skip to sidebar Skip to footer

Applet Code Tags And Class Files

I just started writing Applets and I had some questions about the HTML applet tags with packages, and class files. I'll start with packages. I've been using Netbeans to code my app

Solution 1:

<applet code="myPackage.myCLass.class"width="500"height="500">

As to the applet element for a myClass applet class in the myPackage package.

1) An applet element should have spaces between the attributes (I'm not sure if that is part of the W3C recommendation, but it just looks weird).

<applet code="myPackage.myCLass.class" width="500" height="500">

2) The code attribute should be the fully qualified name of the class, which means:

<applet code="myPackage.myCLass" width="500" height="500">

3) With no archives and no codebase specified, the JRE would look for the class in the myPackage sub-directory of the directory from which the HTML is loaded. E.G. if the HTML is called applet.html and is located at:

The class would need to be located at:

Once you think you have the applet class correct, try fetching it using the address in the browser address bar. If the class is not offered for download, the JRE won't be able to load it either.


Post a Comment for "Applet Code Tags And Class Files"