This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

i'm having trouble with an applet...  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
And inside of my fortune cookie was this tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!