运行appletviewer和html时找不到类异常

时间:2012-09-05 09:01:20

标签: java html applet classnotfound appletviewer

我在appletviewer或我创建的html文件中运行程序时遇到了困难。我可以运行我编译的.class文件,eclipse生成我的图像,但我不能重新创建这个外部日食。我的所有文件都在同一个目录中。

AdvertisementApplet.html:

<html>
<head>
<title>AdvertisementApplet</title>
</head>
<body>
<center>
<applet code=”AdvertisementApplet.class” width="400" height="300"></applet>
</center>
</body>
</html>

AdvertisementApplet.java:

import javax.swing.JApplet;
import java.awt.*;
public class AdvertisementApplet extends JApplet{
public void paint (Graphics page){
page.setColor(Color.cyan);
page.drawRect (50, 50, 40, 40);
page.drawRect (80, 60, 40, 40);
page.drawOval (50, 50, 40, 40);
page.drawLine (50, 50, 40, 40);
page.drawString("out of clutter, find simplicity.", 110, 70);
page.drawString("—Albert Einstein", 130, 100);
    }
}

错误消息:

load: class ”AdvertisementApplet.class” not found.
java.lang.ClassNotFoundException: ”AdvertisementApplet.class”
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.lang.ClassNotFoundException: ”AdvertisementApplet.class” 

0 个答案:

没有答案