Answers for "calling javascript from java"

0

calling javascript from java

ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("JavaScript");
// read script file
engine.eval(Files.newBufferedReader(Paths.get("C:/Scripts/Jsfunctions.js"), StandardCharsets.UTF_8));

Invocable inv = (Invocable) engine;
// call function from script file
inv.invokeFunction("yourFunction", "param");
Posted by: Guest on July-26-2021

Code answers related to "calling javascript from java"

Code answers related to "Javascript"

Browse Popular Code Answers by Language