You have to run your script in interactive mode (-opt -1)
java -classpath js.jar org.mozilla.javascript.tools.shell.Main -opt -1 -f my-script.js
Question
I have a JS script that I want to run with rhino.
On the command line I invoke
java -cp rhino-1.7R4.jar org.mozilla.javascript.tools.shell.Main -f my-script.js
Unfortunately the only output I get is
js: uncaught JavaScript runtime exception: TypeError: Cannot read property "org.mozilla.javascript.Undefined@10d58f09" from undefined
So there is no line information or similar and I have no clue how to identify what is wrong in the script. (Note: the script is a third party script that I want to modify/fix to be executable with rhino, but where should I begin with this cryptic error message?)
Solution
You have to run your script in interactive mode (-opt -1)
java -classpath js.jar org.mozilla.javascript.tools.shell.Main -opt -1 -f my-script.js