I am writing an applet in Eclipse. It does work in the JApplet viewer. However, when I try to make ANY applet run in ANY browser I get the ClassNotFound exception. For example:
import javax.swing.JApplet;
public class TestApplet extends JApplet
{
public void init()
{
this.setSize(800, 600);
this.setVisible(true);
}
public void start()
{
}
}
This launches in the applet viewer. When embedded in this code,
<html>
<body>
<applet code = "TestApplet.class">
<applet>
</body>
</htmL>
I get the above mentioned error. The applet is in the same folder as the webpage. Tested it on 2 different computers. What am I doing wrong?
That HTML is not valid.
I wish programmers would realize that throwing 'any old crap' together does not result in valid HTML. Mark-up needs to be validated. One way to validate it is to use the W3C Markup Validation Service.
Once that is sorted, note that it might still have problems. Ensure the Java Console is configured to show for applets & copy/paste any output.