Dov
Dov

Reputation: 8570

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. But I can't find decent documentation, or even a tutorial on how to use the object tag to launch an 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

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.

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. They also had examples requesting a specific version.

Even if this is true, how do I:

  1. specify the jar file
  2. specify the class (is this correct above)
  3. specify the directory where the code is (is codebase still valid?)

Upvotes: 4

Views: 648

Answers (1)

user1242756
user1242756

Reputation: 231

First of all, the syntax is not the same for firefox and 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:

<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

Upvotes: 4

Related Questions