How to prevent built-in functions or objects to be overwritten?

Trig Chen trigchen at
Tue Mar 1 01:43:01 UTC 2016

I'm using nashorn engine in embedding mode and providing user a command
line textbox to interactive with nashorn. It's fund that nashorn engine's
built-in functions or objects such as quit, Java were overwritten by user's
mistaken typing:

quit=3;   Java="Hello";

Is there a way to prevent user overwrite the built-in functions, objects
and java objects exposed to nashorn engine?

More information about the nashorn-dev mailing list