简体   繁体   English

启动java applet

[英]launching java applet

As far as I can see from the documentation, <applet> is deprecated, and the <object> tag is the preferred method for launching an applet now. 据我在文档中看到,不推荐使用<applet> ,而<object>标签是现在启动applet的首选方法。 But I can't find decent documentation, or even a tutorial on how to use the object tag to launch an applet. 但是我找不到合适的文档,甚至是关于如何使用object标签来启动applet的教程。

I did see the following question which shows how in javascript but I would prefer to use a tag launch applet from web page 我确实看到以下问题,它显示了如何在JavaScript中,但我更喜欢从网页使用标签启动小程序

I need to know how to specify the java engine, how to specify a jar file, where it's stored, and how to specify the class that is executed. 我需要知道如何指定java引擎,如何指定jar文件,它存储在哪里,以及如何指定执行的类。

Here's what i have at the moment (but does not work) 这是我现在所拥有的(但不起作用)

<object
   classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
   width="800" height="600" data="pi.jar">
    <param name="code" value="PiLauncher.class"/>
</object>

the claim was in the Oracle 1.5 docs that this classid specifies "the current java engine" but this is completely opaque to me. 索赔是在Oracle 1.5文档中,这个classid指定“当前的java引擎”,但这对我来说是完全不透明的。 They also had examples requesting a specific version. 他们还有一些请求特定版本的示例。

Even if this is true, how do I: 即使这是真的,我该怎么做:

  1. specify the jar file 指定jar文件
  2. specify the class (is this correct above) 指定类(上面这是正确的)
  3. specify the directory where the code is (is codebase still valid?) 指定代码所在的目录(代码库是否仍然有效?)

First of all, the syntax is not the same for firefox and IE: 首先,firefox和IE的语法不一样:

Firefox: 火狐:

<object classid="clsid:CAFEEFAC-0017-0000-0000-ABCDEFFEDCBA" id="appletId" name="appletName" width="400" height="300">
    <param name="code" value="com.myPackage.Applet" />
    <param name="codebase" value="../resources/applet/"/>
    <param name="ARCHIVE" value="myApplet.jar" />
    <param name="cache_archive" value="myApplet.jar" />
    <param name="type" value="application/x-java-applet" />
    <param name="cache_option" value="plugin" />
    <param name="mayscript" value="true" />
    // you can set optional parameters here 
</object>

IE: IE:

<object width="400" height="300" classid="java:com.myPackage.Applet.class" codebase="../resources/applet/" name="appletName" id="appletId">
    <param name="archive" value="myApplet.jar" />
    <param name="type" value="application/x-java-applet" />
    <param name="cache_option" value="plugin" />
    <param name="mayscript" value="true" />
    // you can set optional parameters here         
</object> 

Here is a good link: http://docs.oracle.com/javase/1.5.0/docs/guide/plugin/developer_guide/using_tags.html#object 这是一个很好的链接: http//docs.oracle.com/javase/1.5.0/docs/guide/plugin/developer_guide/using_tags.html#object

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

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