I am creating a sandbox program with the nashorn js interpreter, and using a minimalist security manager to restrict what it can do.
The problem is when I call engine.eval(reader)
I get a null pointer exception.
I know the reader works because I was able to print the entire file, letter-by-letter.
I know this is a permissions issue because if I add AllPermissions then everything works.
So what permissions do I need to run a script in nashorn?
Apparently I messed up my initial tests, it's not just with the file reader, it also happens when I hard-code a string.
I found the problem. Apparently I need this permission to run nashorn:
java.io.FilePermission, "/usr/lib/jvm/java-8-openjdk/jre/lib/ext/nashorn.jar", "read"