Rhino JavaScript Example - Shell.java

Q

How to run Rhino JavaScript Example, Shell.java?

✍: FYIcenter.com

A

Shell.java is an example program provided in the rhino-Rhino1_7_14_Release.zip package. It allows you to run JavaScript statements in an interactive shell.

Here is how to use Shell.java, if you have rhino-runtime-1.7.14.jar installed:

fyicenter> cd rhino-Rhino1_7_14_Release

rhino-Rhino1_7_14_Release> cd examples

examples> java -cp ../../rhino-runtime-1.7.14.jar Shell.java 

js> Math.PI;
3.141592653589793

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

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

js> <Ctrl-C>

Here is the Hello.js file used in the above test:

var name = "FYIcenter.com";
java.lang.System.out.println("Hello, welcome to "+name+"!");

 

Rhino JavaScript Example - RunScript.java

Download Rhino JavaScript rhino-Rhino1_7_14_Release.zip

Rhino JavaScript Examples and Tools

⇑⇑ FAQ for Rhino JavaScript Java Library

2022-04-21, 527🔥, 0💬