aspose file tools*
The moose likes Applets and the fly likes Applet in HTML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet in HTML" Watch "Applet in HTML" New topic
Author

Applet in HTML

Jasper Beckers
Greenhorn

Joined: Sep 05, 2009
Posts: 4
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

Joined: Oct 13, 2005
Posts: 39818
    
  28
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

Joined: Sep 05, 2009
Posts: 4
I copied the html code off a tutorial website...

I use Eclipse to write and open my applets.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61628
    
  67

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.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42602
    
  65
The class file must be in the same directory as the HTML file for this to work.


Ping & DNS - my free Android networking tools app
Ana Suvari
Ranch Hand

Joined: Aug 18, 2009
Posts: 43
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 agree. Here's the link: http://aspose.com/file-tools
 
subject: Applet in HTML