1ScriptEngineManager manager = new ScriptEngineManager();
2ScriptEngine engine = manager.getEngineByName("JavaScript");
3// read script file
4engine.eval(Files.newBufferedReader(Paths.get("C:/Scripts/Jsfunctions.js"), StandardCharsets.UTF_8));
5
6Invocable inv = (Invocable) engine;
7// call function from script file
8inv.invokeFunction("yourFunction", "param");
9