Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Can't run my applet on a html page

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote a small applet to load an image on the applet. Code..


The html code going with it is


This runs fine when it is run using appletviewer from command prompt. But when I try to load it on a browser it does not load and see
Loading Java Applet failed...

Please help

Thanks
Kits
 
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry - as a security precaution, unsigned applets can't open local files.
 
Bartender
Posts: 9612
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Get rid of the CODEBASE parameter in the HTML. Provided that the gif is in the same directory as the HTML it should work.
 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It could also be possible that the browser might not recognize the version of jdk you are using to compile the file. Try this, compile the applet for a lower rated version. You can do this in the following manner. In the shell or Dos prompt, compile the applet by entering -

javac YourClassName.java -target 1.1

This creates the class according to JDK 1.1 specifications. It helped me solve a problem once, all the best to you.

Please tell what happened.
-------------------------------------------------------
Submit your java application/applets for reviewing. Find codes. Become a member today - www.thejavahub.com
 
I brought this back from the farm where they grow the tiny ads:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic