This discussion is archived
0 Replies Latest reply: Aug 22, 2012 1:25 AM by 957138 RSS

Invoke javascript from Applet

957138 Newbie
Currently Being Moderated

I want to use Java Scripting to invoke javascript code from an Applet.

I found a documentation at "". But I don't want to pass a separate javascript file since my applet is embedded in an html file my javascript code is also there. Like below:

ScriptEngine engine = manager.getEngineByName("js");
FileReader reader = new FileReader("<location>\\Test.js"); //I DONT WANT TO DO IT THIS WAY
Invocable inv = (Invocable) engine;
inv.invokeFunction("function" );

I searched on internet and found that I can use netscape.JSObject in my Applet class for the purpose. But it seems the package is going to be dropped in future releases. I am looking for an alternative.



  • Correct Answers - 10 points
  • Helpful Answers - 5 points