Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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

Applet in HTML

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm quite new to Java and I've only created a few applets. I would like to show them to my friends,but every time I try to put them in an HTML file I get an error:
NoClassDefFoundError.

The applets work perfectly fine, this is an example:



This is the HTML code I'm using:



The HTML file's name is test.html.
Does someone have a solution or explanation?
 
Marshal
Posts: 69455
277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you using Capital Letters in your html?

How are you opening the applets? Are you using appletviewer? Or are you opening them with a web browser?
 
Jasper Beckers
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I copied the html code off a tutorial website...

I use Eclipse to write and open my applets.
 
Sheriff
Posts: 67402
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Experienced devos will generally use all lower-case for their HTML. And with HTML 5 beginning to tendril into pages, it's also considered a good idea to follow XHTML "well-formedness" rules (quote attributes, don't leave off end tags, etc) as HTML 5 will allow either loose or well-formed syntax.

Oh, and please indent.
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The class file must be in the same directory as the HTML file for this to work.
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what the problem is. But i always use extends JApplet , not Applet.
Make sure you upload the class you specified in your html code.
 
I'm still in control here. LOOK at this tiny ad!
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic