0 Replies Latest reply: Aug 22, 2012 3:25 AM by 957138 RSS

    Invoke javascript from Applet


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

      I found a documentation at "http://docs.oracle.com/javase/6/docs/technotes/guides/scripting/programmer_guide/index.html#evalfile". 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.