Hello, I made a simple applet and a simple html file to run this applet in a browser. But when I load the html file into a web browser it told me that MyApplet could not be found. I tried "appletviewer MyFile.html" in the shell and it worked. Does any body have an idea about this problem? My CLASSPATH contains only "." Thank you in advance.
Make sure you refer to the right class. Thus, if the applet lies in a package called "mypackage" and the applet classfile is called MyApplet.class a legal name for the class would be "mypackage.MyApplet.class". E.g. This is the applet-tag(note: the classloader looks for the classes, begining from the html-document) <Applet code="mypackage.MyApplet.class" width="300" height="300"></Applet> Another example: If you put your classes in a jar-file you could use the "archive" attribute like this. <Applet code="mypackage.MyApplet.class" archive="myarchive.jar" width="300" height="300"></Applet> Note:When you put your classes in a jar the browser only opens one connection and loads all the classes at the same time. Otherwhise the browser opens a new connection for each file it download. regards, /Peter
Originally posted by Houssam Haitof: Thank you for your interest, yes the html file and the class file are in the same directory. I load my file using File/Open or just by double clicking on it and it still does not work :/
You know it is dark times when the trees riot. I think this tiny ad is their leader:
Devious Experiments for a Truly Passive Greenhouse!