我的对象标签嵌入 Java Applet 有什么问题?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2730183/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 22:33:41  来源:igfitidea点击:

What's wrong with my object tag to embed a Java Applet?

javaapplet

提问by

Here is my object tag.

这是我的对象标签。

    <object classid="java:my.full.class.Name.class"
            height="360" width="320">
        <param name="type" value="application/x-java-applet">
        <param name="archive" value="applets.jar">
        <param name="file" value="/report_files/1-1272041330710YAIwK">
        <param name="codebase" value="/applets">
    </object>

When I run this in firefox it just shows up with an Error, click for details. The java console shows absolutely nothing. And at the bottom of fire fox is says "Applet my.full.class.Name notloaded". The Name.class file is in the applets.jar file. I can type the URL /applets/applets.jar and access the jar file. So whats wrong?

当我在 Firefox 中运行它时,它只显示一个错误,单击以获取详细信息。Java 控制台完全没有显示任何内容。在火狐的底部说“Applet my.full.class.Name notloaded”。Name.class 文件位于 applet.jar 文件中。我可以输入 URL /applet/applet.jar 并访问 jar 文件。那么怎么了?

EDIT: I can access the param file as well, although I don't believe that is the issue.

编辑:我也可以访问 param 文件,尽管我认为这不是问题所在。

EDIT: I updated the tag because I noticed in my HTML logs it wasn't looking in the right place. Still nothing though

编辑:我更新了标签,因为我在我的 HTML 日志中注意到它没有找到正确的位置。还是什么都没有

采纳答案by Bozho

<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" 
    codebase="http://java.sun.com/update/1.6.0/jinstall-1_6-windows-i586.cab#Version=1,6,0,0"
    code="my.full.class.Name"
    archive="/applets/applets.jar" ... />

See the documentation!

看文档!

(and you must not add .classto fully-qualified class names)

(并且您不得添加.class到完全限定的类名中)

回答by Anon

Firefox fails with a classid attribute. The below should work cross browser:-

Firefox 因 classid 属性而失败。以下应该跨浏览器工作:-

<p>
<object type="application/x-java-applet"
    name="previewersGraph" width="360" height="320">
    <param name="codebase" value="/applets" />
    <param name="code" value="my.full.class.Name" />
    <param name="archive" value="applets.jar" />
    <param name="scriptable" value="true" />
    <param name="mayscript" value="true" />
    <param name="file" value="/report_files/1-1272041330710YAIwK" />
</object>
</p>

In my tests both IE8 and FF5 required the "type" attribute. The mayscript param is only required for Java plugins before 1.6.0.10. The scriptable param is still required according to javadocs 1.6.0.21. However, in a test with 1.6.0.24 for a signed applet, IE8 called it OK from JS without scriptable being set true.

在我的测试中,IE8 和 FF5 都需要“type”属性。仅 1.6.0.10 之前的 Java 插件需要 mayscript 参数。根据 javadocs 1.6.0.21,脚本化参数仍然是必需的。但是,在使用 1.6.0.24 对已签名小程序进行的测试中,IE8 在 JS 中称其为 OK,而无需将 scriptable 设置为 true。