Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
RhinoHello.java - Rhino JavaScript Hello Example
How to write a simple "Hello World!" example with Rhino JavaScript Java library? I have Rhino 1.7R5 installed.
✍: FYIcenter
If your have Rhino 1.7R5 installed, you can try the following example program, RhinoHello.java:
// Copyright (c) 2017 FYIcenter.com import org.mozilla.javascript.ContextFactory; import org.mozilla.javascript.Context; import org.mozilla.javascript.Scriptable; public class RhinoHello { public static void main(String[] args) throws Exception { ContextFactory f = new ContextFactory(); Context c = f.enterContext(); Scriptable s = c.initStandardObjects(); String js = "java.lang.System.out.println('Hello world!')"; c.evaluateString(s, js, null, 1, null); } }
Compile and run the example program, RhinoHello.java:
>\fyicenter\jdk-1.8.0\bin\javac -cp \fyicenter\rhino1_7R5\js.jar RhinoHello.java >\fyicenter\jdk-1.8.0\bin\java -cp .;\fyicenter\rhino1_7R5\js.jar RhinoHello Hello world!
⇒ RhinoSystemOut.java - Mapping Java Object to Rhino
⇐ Using Rhino JavaScript Library in Java Programs
2023-07-18, 3768🔥, 1💬
Popular Posts:
What Is jtds-1.2.2.jar? jtds-1.2.2.jar is the JAR files of jTDS Java library 1.2.2, which is a JDBC ...
What Is in Xerces-J-bin.2.12.2.zip? Xerces-J-bin.2.12.2.zip file is the distribution package ZIP fil...
JDK 11 jdk.internal.le.jmod is the JMOD file for JDK 11 Internal Line Editing module. JDK 11 Interna...
Apache Commons Codec library provides implementations of common encoders and decoders such as Base64...
What Is commons-fileupload-1.3.3 .jar?commons-fileupload-1.3.3 .jaris the JAR file for Apache Common...