Java Tools Tutorials - Herong's Tutorial Examples - v6.23, by Herong Yang
"jrunscript" - Run JavaScript Interactively
This section provides a tutorial example on how to use 'jrunscript' to run JavaScript code interactively.
As the first test, I want to use "jrunscript" to run some simple JavaScript script lines interactively:
herong> jrunscript Warning: Nashorn engine is planned to be removed from a future JDK release nashorn> Math.PI*0.5*0.5; 0.7853981633974483 nashorn> println("Hello World!"); Hello World! nashorn> x = "Apple", y = "Orange"; Orange nashorn> print(x); Apple nashorn> exit();
To find out what script engines are supported in my OpenJDK package, I used the "jrunscript -q" command.
herong$ java -version openjdk version "11.0.7" 2020-04-14 LTS OpenJDK Runtime Environment 18.9 (build 11.0.7+10-LTS) OpenJDK 64-Bit Server VM 18.9 (build 11.0.7+10-LTS, mixed mode, sharing) herong$ jrunscript -q Language ECMAScript ECMA - 262 Edition 5.1 implementation \ "Oracle Nashorn" 11.0.7
Cool. "jrunscript" is easy to use. And the OpenJDK 11 only supports Nashorn 11 engine for JavaScript.
Table of Contents
javac - The Java Program Compiler
java - The Java Program Launcher
jpackage - Binary Package Builder
javadoc - The Java Document Generator
jdeps - The Java Class Dependency Analyzer
jdeprscan - The Java Deprecated API Scanner
jcmd - The JVM Diagnostic Tool
jconsole - Java Monitoring and Management Console
jstat - JVM Statistics Monitoring Tool
jhsdb - The Java HotSpot Debugger
jvisualvm (Java VisualVM) - JVM Visual Tool
javap - The Java Class File Disassembler
keytool - Public Key Certificate Tool
►jrunscript - Script Code Shell
►"jrunscript" - Run JavaScript Interactively
"jrunscript -f" - Run JavaScript in Batch Mode
native2ascii - Native-to-ASCII Encoding Converter