简体   繁体   中英

Java applet deploying error

I have an applet like this

package myPackage;

public class MyApplet extends JApplet
{
....

My html have this code

<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.

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 :

When deploying applets:

  • Use the applet tag if the Web page is accessed through the Internet.
  • Use the object or embed tag if the Web page is accessed through an Intranet.

And:

Note: The HTML specification states that the applet tag is deprecated , and that you should use the object tag instead. However, the specification is vague about how browsers should implement the object tag to support Java applets, and browser support is currently inconsistent. Sun therefore recommends that you continue to use the applet tag as a consistent way to deploy Java applets across browsers on all platforms.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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