Test: import javax.script.*; import jdk.nashorn.api.scripting.JSObject; public class Main { public static void main(String[] args) throws Exception { ScriptEngineManager m = new ScriptEngineManager(); ScriptEngine e = m.getEngineByName("nashorn"); JSObject jsobj = (JSObject) e.eval("({ foo: 23})"); jsobj.eval("print(Object.keys(this))"); jsobj.eval("print(this.foo)"); } } Output expected: foo 23 Output seen undefined Clearly, "global" is passed as "this" to the script evaluated by JSObject.eval.