Java小程序将不会加载 [英] Java applet won't load

查看:118
本文介绍了Java小程序将不会加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立在Java applet小。它工作正常(是真的!),当我在Eclipse中运行它作为一个小程序。当我出口它作为一个罐子的问题开始,不是试图通过一个html页面加载它。
这里的HTML code:

I am building a small applet in java. It works fine (really!) when I run it in eclipse as an applet. Problems start when I export it as a jar and than try to load it through an html page. Here's the html code:

<body>

<applet  archive="myJar.jar" width=650 height=850>

</applet>
</body>

现在当我运行这样他们正常工作的其他jar文件,例如,如果您查看此niffty的演示

Now when I run other jar files in this way they work fine, for example if you view the source page of this niffty demo

    <body>
    <applet code="org.niffty.Niffty.class" archive="niffty.jar" width=650 height=850>
    <param name="file" value="prelude.nif">
    </applet>
    </body>

感谢您!

推荐答案

您错过在你的 code 属性小程序标记。没有它,浏览器不知道哪一个类你的JAR文件应该显示小应用程序。

You're missing the code attribute in your applet tag. Without it, the browser doesn't know which class in your JAR file is the applet it should display.

这篇关于Java小程序将不会加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆