Win a copy of AWS Security this week in the Cloud/Virtualization 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Running an applet in a web browser.

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Houssam,
Make sure that you have your HTML and jar/class files in the same directory. Load it into your browser using open as a file.
Regards,
Manfred.
 
Houssam Haitof
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 :/
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic