Rhino Tool - JavaScript Shell


How to run the Rhino Tool JavaScript Shell?

✍: FYIcenter.com


Rhino Tool JavaScript Shell allows you to run JavaScript statements in an interactive shell.

JavaScript Shell is included in the rhino-Rhino1_7_14_Release.zip package in the "toolsrc" sub-directory.

Here is how to use the JavaScript Compiler:

1. Use "javac" to prepare supporting classes:

fyicenter> cd rhino-Rhino1_7_14_Release

rhino-Rhino1_7_14_Release> cd toolsrc

toolsrc> javac -cp ../../rhino-runtime-1.7.14.jar org/mozilla/javascript/tools/*.java

2. Use "javac" to prepare the Shell class:

toolsrc> javac -cp .:../../rhino-runtime-1.7.14.jar org/mozilla/javascript/tools/shell/Main.java 

3. Run JavaScript Shell:

toolsrc> java -cp .:../../rhino-runtime-1.7.14.jar org.mozilla.javascript.tools.shell.Main
Rhino 1.7.14

js> Math.PI; 

js> System.out.println("Hello World!");
js: uncaught JavaScript runtime exception: ReferenceError: "System" is not defined.

js> java.lang.System.out.println("Hello World!");
Hello World!

js> load("Hello.js");
Hello, welcome to FYIcenter.com!

js> <Ctrl-C>


Using Rhino JavaScript Library in Java Programs

Rhino Tool - JavaScript Compiler

Rhino JavaScript Examples and Tools

⇑⇑ FAQ for Rhino JavaScript Java Library

2022-04-13, 233👍, 0💬