Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can't get applet to run as OBJECT element

843807Dec 2 2008 — edited Dec 10 2008
Hi

I have an applet in a web page that works fine but I need to convert it to an OBJECT element because I know it doesn't work unless the browser is the same, and if it has the same Java as I have, i.e. Sun Java, not MS.

I've tried several things and just can't get it to work. I know about the Sun reference pages for how to set up the classid but still, the object ends up as null. I guess it's not loading but have no clue why. The applet should at least appear as a white block, but all I see is the logo before loading.

The applet provides functions to an HTML form. Below is how it's called. I compiled with Sun's Java JDK 1.5 SE and have the same Java set up in my browsers - IE v7 on a Vista machine and IE v6.0 on a Win ME.

This is the code... in a Javascript block:

document.polyApplet2.compute(func,arg); //// JAVASCRIPT ERROR ON THIS LINE. polyApplet2 is null
result = document.polyApplet2.resultJS;

Then,

<applet name="polyApplet2" code="PolyApplet.class" archive="jarPolyApplet.jar" width=50 height=50>
</applet>

---------------------------------

In the applet is

public String resultJS = "";
public void computeJS(String func, String poly)
{
the program
}

---------------------------------

I have both the jar file and the class file on the server for now. Prefer the jar file but will ue class if Object requires it.


I tried this OBJECT code:

<object classid="clsid:CAFEEFAC-0015-0000-FFFF-ABCDEFFEDCBA" width=50 height=50
id="polyApplet2" archive="jarPolyApplet.jar">
<param name="code" value="PolyApplet2" />
</object>

---------------------------------

any ideas what I'm doing wrong? Wrong classid? Are the parts CAFEEFCA and ABCDEF... literal or to be replaced by something?

thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 7 2009
Added on Dec 2 2008
6 comments
244 views