hi. i have an applet which i want to run from my webpage. if my webpage's address is "www.sam.com" for example, how can i include my applet in the webpage so that people visiting my webpage can run the applet. i have a way in mind, but i'm not sure if it works: <html> <applet code="xxxx.class" width=50 height=50> </applet> </html> a detailed responce would be highly appreciated. thanks. sam.
I am not an experienced Java programmer, but in the spirit of this board I will help as much as I can. What you have looks like it will work as long as the file xxxx.class is in the same directory as your HTML file. If not, you have to use the CODEBASE tag to specify the location of the .class file. Here is an example (my comments in square brackets -- don't include them in your HTML code): <applet CODE="OscilaApplet1.class" [name of class file] CODEBASE="../java/" [location of class file] WIDTH="620" HEIGHT="320" HSPACE="0" VSPACE="0" ALIGN="middle"> </applet> The "../" symbol in the codebase tag means "move up one directory." If you want to include the CODEBASE tag even though the class file is in the same directory as the HTML file, use "./" instead, which means "same directory." When you visit an applet on a Web page that works, look at the page source to see how they did it. (In Netscape, you can see the page source by pulling down the "View" menu at the top of the browser and selecting "Page Source".) Try downloading the .class file from the hosts computer. You should always be able to download it as long as you have correctly figured out where the class file is located from the CODEBASE tag. Hope this helps.
Paddy spent all of his days in the O'Furniture back yard with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop