Q:

Java/Scala Nashorn disable exit()?

Hello is there a way to disable Nashorn's exit function in Java?
Currently if I have a script engine (Scala):
val engine = new NashornScriptEngineFactory().getScriptEngine("-strict", "--no-java", "--no-syntax-extensions")

I could still run the following:
engine.eval("exit(1);");

I mean it's javascript so I could have a eval before with the following:
engine.eval("exit = undefined");

However I thought that I could make it more safe with java code, is there any way of making the Nashorn Script Engine more strict that such Safetyness is there by default?

A:

Thanks to the help of others I found two ways:
either like @matt suggested:
bindings.remove("exit");

or via
engine.eval("exit = undefined");

