Using Applets in JavaScript

M

mexicanopelon

Greetings,

Although I am familiar with JavaScript, I am new to the concept of
using Applets in JS. Here is what I am trying to do. I have an Applet
will call "FooApplet" with some "fooFunction" returning a String. The
applet accesses a class "ExternalClass" with some "externalFunc"
returning a String. "ExternalClass" is part of a .jar file will call
"externals.jar".


public class FooApplet extends Applet {

public String fooFunction(String input1, String input2) {
do some stuff....
ExternalClass ec = new ExternalClass();
return (ec.externalFunc(param1, param2);
}
}


In my JavaScript file I am calling the "fooFunction" as follows:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE></TITLE>

<SCRIPT LANGUAGE="JavaScript">
<!--
function doSomething() {
alert(document.fooApp.fooFunction("input1", "input2");
}

// -->
</SCRIPT>
</HEAD>

<BODY BGCOLOR="WHITE">
<H1>Queue Depth</H1>

<APPLET CODE="FooApplet" ARCHIVE="externals.jar" WIDTH=10 HEIGHT=10
NAME="fooApp">
</APPLET>

Click the link to see something:
<A onClick="doSomething()"> Do Something </A>

</BODY>
</HTML>



The Java code compiles fine. When I open the HTML page it shows up
fine and the status bar indicates that the Applet has started. When I
click on the link I get a "java.lang.NoClassDefFoundError". I have
determined that problem is linked to the Applet trying to access the
function in the "ExternalClass", because it works when I replace
'return (ec.externalFunc(param1, param2)' with a simple 'return
("Hello");'. As you can see I even tried adding the external .jar file
to the ARCHIVE attribute, but it still doesn't work.

If you have any suggestions, please let me know?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top