apatrida
01/04/2017, 10:37 PM// evaluate JavaScript code that defines an object with one method
engine.eval("var obj = new Object()");
engine.eval("obj.hello = function(name) { print('Hello, ' + name) }");
// expose object defined in the script to the Java application
Object obj = engine.get("obj”);