简体   繁体   中英

JApplet ClassNotFoundException with any applet

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM