How do you return an exit code from Rhino?

rhino

Solution

you could use

java.lang.System.exit(1);

Problem

I'm using java to run a command line utility written in Rhino but if there is an error I need to return that error back to the shell so processing stops. How do I pass back an error code from Rhino to the shell?

Original source