"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 JavaScrpt 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;

nashorn> println("Hello World!");
Hello World!

nashorn> x = "Apple", y = "Orange";

nashorn> print(x);

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

 About This Book

 Java Tools Terminology

 Java Tools Included in JDK

 javac - The Java Program Compiler

 jar - The JAR File Tool

 jlink - The JRE Linker

 jmod - The JMOD File Tool

 jimage - The JIMAGE File Tool

 jpackage - Binary Package Builder

 java - The Java Program Launcher

 jdeps - The Java Class Dependency Analyzer

 jdeprscan - The Java Deprecated API Scanner

 jdb - The Java Debugger

 jcmd - The JVM Diagnostic Tool

 jconsole - Java Monitoring and Management Console

 jstat - JVM Statistics Monitoring Tool

 JVM Troubleshooting Tools

 jhsdb - The Java HotSpot Debugger

 jvisualvm (Java VisualVM) - JVM Visual Tool

 jmc - Java Mission Control

 javap - The Java Class File Disassembler

 keytool - Public Key Certificate Tool

 jarsigner - JAR File Signer

 jshell - Java Language Shell

jrunscript - Script Code Shell

 jrunscript - What Is It

"jrunscript" - Run JavaScript Interactively

 "jrunscript -f" - Run JavaScript in Batch Mode

 serialver - serialVersionUID Generator

 native2ascii - Native-to-ASCII Encoding Converter

 Outdated Tutorials


 Full Version in PDF/EPUB