Reputation: 623
I use java Rhino lib as a script engine in my application, so that users can write their own script to control the application to do some job,
but I don't want them to use the java system lib classes in script ,ex:"java.lang.Sytem.exit()",
does anyone know how to do?? thank you
Upvotes: 0
Views: 301
Reputation: 3821
Call Context.setClassShutter(ClassShutter)
on your context with an appropriate ClassShutter
implementation that implements the method visibleToScripts(String fullClassName)
in whatever way you wish to filter out (or in) whatever classes you want to have be usable from the scripts.
Upvotes: 1