Consider the following methods: http://docs.oracle.com/javase/8/docs/api/javax/script/ScriptContext.html#getAttribute-java.lang.String-int- http://docs.oracle.com/javase/8/docs/api/javax/script/ScriptContext.html#removeAttribute-java.lang.String-int- For attribute names which are undefined they behave differently for Nashorn: new ScriptEngineManager() .getEngineFactories() .stream() .map(ScriptEngineFactory::getScriptEngine) .map((engine) -> { System.err.println("engine = " + engine); return engine.getContext(); }) .forEach(c -> { System.err.println("context = " + c); System.err.println("get returns = " + c.getAttribute("undefinedname", ScriptContext.ENGINE_SCOPE)); System.err.println("remove returns = " + c.removeAttribute("undefinedname", ScriptContext.ENGINE_SCOPE)); }); When run v.s. OracleJDK the output will be like: engine = jdk.nashorn.api.scripting.NashornScriptEngine@f3eef9 context = javax.script.SimpleScriptContext@3c4f91 get returns = null remove returns = undefined The following JCK9 test fails due to this: api/javax_script/ScriptContext/index.html#SetGetAttribute[remove_noValueDefined]