I downloaded Mozilla Rhino so I can use the interactive JavaScript console through
java -jar js.jar
I can get into the prompt, and everything is all working fine. Except... My arrow keys are not mapped to move the cursor back a开发者_开发知识库nd forth or to use the history function with up and down. Now, according to the documentation, these features do exist in the interactive console, but they seem to break on Mac OS. I need some pointers to change these settings or add code to support this?
When using JSC, I do not have this problem.
Thanks,
There are no built-in key bindings when running just "js.jar" like that. What you may want to do is look into the JLine "console runner" project.
Looks like with version 1.7R2 they added support for JLine. You just need to add it to the class path e.g.
java -cp js.jar:lib/jline-0.9.93.jar org.mozilla.javascript.tools.shell.Main
Reference: https://developer.mozilla.org/en/docs/New_in_Rhino_1.7R2
精彩评论