Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet in HTML

 
Jasper Beckers
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?
 
Campbell Ritchie
Sheriff
Pie
Posts: 50225
79
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65221
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • 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.
 
Ana Suvari
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic