Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
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 (322)
Collections:
Other Resources:
Example code to Test rhino-runtime-1.7.14.jar
How to test rhino-runtime-1.7.14.jar?
✍: FYIcenter
You can write a simple Java program, RhinoRuntimeTest.java, to test rhino-runtime-1.7.14.jar:
// Copyright (c) FYIcenter.com
import org.mozilla.javascript.Context;
import org.mozilla.javascript.Scriptable;
public class RhinoRuntimeTest {
public static void main(String args[]) {
Context cx = Context.enter();
try {
Scriptable scope = cx.initStandardObjects();
String js =
"function p2k(p) {return p*0.453592;} '5 pound = '+p2k(5.0)+' kilo';";
Object result = cx.evaluateString(scope, js, "<cmd>", 1, null);
System.err.println(Context.toString(result));
} finally {
Context.exit();
}
}
}
6. Run the test program, RhinoRuntimeTest.java:
\fyicenter> java -cp rhino-runtime-1.7.14.jar RhinoRuntimeTest.java 5 pound = 2.26796 kilo
⇒ Download Rhino JavaScript rhino1_7R5.zip
⇐ Rhino JavaScript Java Library Source Code
2023-02-21, ∼3685🔥, 6💬
Popular Posts:
ANTLR is a powerful parser generator for multiple programming languages including Java. ANTLR contai...
JDK 17 jdk.internal.le.jmod is the JMOD file for JDK 17 Internal Line Editing module. JDK 17 Interna...
What Is poi-ooxml-5.2.3.jar? poi-ooxml-5.2.3.jar is one of the JAR files for Apache POI 5.2.3, which...
JDK 17 jdk.dynalink.jmod is the JMOD file for JDK 17 Dynamic Linking module. JDK 17 Dynamic Linking ...
What Is javaws.jar in JRE (Java Runtime Environment) 8? javaws.jar in JRE (Java Runtime Environment)...