简体   繁体   English

Java applet部署错误

[英]Java applet deploying error

I have an applet like this 我有这样的小程序

package myPackage;

public class MyApplet extends JApplet
{
....

My html have this code 我的HTML有这个代码

<object id="MyApplet" height="100" width="100" name="MyApplet" type="application/x-java-applet;version=1.4.1">
    <param name="archive" value="MyApplet.jar"" />
    <param name="code" value="myPackage.MyApplet" />
    <param name="mayscript" value="yes" />
    <param name="scriptable" value="true" />
    <param name="name" value="MyApplet" />
</object>

When trying applet functionality on localhost - everything is OK. 在localhost上尝试applet功能时 - 一切正常。

But from another computer I have an error 但是从另一台计算机上我有一个错误

load: class myPackage.MyApplet not found.
java.lang.ClassNotFoundException: myPackage.MyApplet
    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: myPackage.MyApplet

From Java/Oracle documentation : Java / Oracle文档

When deploying applets: 部署applet时:

  • Use the applet tag if the Web page is accessed through the Internet. 如果通过Internet访问网页,请使用applet标记。
  • Use the object or embed tag if the Web page is accessed through an Intranet. 如果通过Intranet访问网页,请使用object或embed标记。

And: 和:

Note: The HTML specification states that the applet tag is deprecated , and that you should use the object tag instead. 注意:HTML规范声明不推荐使用 applet标记,而是应该使用object标记。 However, the specification is vague about how browsers should implement the object tag to support Java applets, and browser support is currently inconsistent. 但是,规范对于浏览器应该如何实现对象标记来支持Java applet是模糊的,并且浏览器支持目前是不一致的。 Sun therefore recommends that you continue to use the applet tag as a consistent way to deploy Java applets across browsers on all platforms. 因此Sun建议您继续使用applet标记作为在所有平台上跨浏览器部署Java applet的一致方式。

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

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