简体   繁体   English

JApplet ClassNotFoundException与任何小程序

[英]JApplet ClassNotFoundException with any applet

I am writing an applet in Eclipse. 我在Eclipse中编写小程序。 It does work in the JApplet viewer. 它确实在JApplet查看器中工作。 However, when I try to make ANY applet run in ANY browser I get the ClassNotFound exception. 但是,当我尝试使ANY小程序在ANY浏览器中运行时,出现ClassNotFound异常。 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. 这将在applet查看器中启动。 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. 在2台不同的计算机上进行了测试。 What am I doing wrong? 我究竟做错了什么?

That HTML is not valid. 该HTML无效。

I wish programmers would realize that throwing 'any old crap' together does not result in valid HTML. 我希望程序员会意识到,将“任何旧的废话”放在一起不会产生有效的HTML。 Mark-up needs to be validated. 标记需要验证。 One way to validate it is to use the W3C Markup Validation Service . 验证它的一种方法是使用W3C标记验证服务

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. 确保将Java控制台配置为显示小程序并复制/粘贴任何输出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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