在网页中嵌入applet时出现ClassNotFoundException

时间:2014-03-06 19:29:59

标签: java applet webpage classnotfoundexception

我在eclipse中创建了一个java applet,我试图将它嵌入到网页中。我导出了jar文件,我的html看起来像:

<html>
    <head>
        <title> Title </title>
    </head>
    <body>
        <applet code ="Game.class" archive="applet.jar" width = "854" height="641">

    </body>
</html>

我正在为Game.class找到一个未找到类的异常。 我使用7个zip检查Game.class是否存在而且确实存在。有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

  

我在Game:package edu.elon.game的顶部声明我的包裹;

然后你需要在applet标签code标签中指定它以匹配完全限定的类名

<applet code ="edu.elon.game.Game.class" archive="applet.jar" width = "854" height="641">
               ^-----------^