GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
JJS(1) JDK Commands JJS(1)

jjs - command-line tool to invoke the Nashorn engine

Note: The jjs tool and the Nashorn engine are deprecated in JDK 11 in preparation for removal in a future release.

jjs [options] script-files [-- arguments]

options
This represents one or more options of the jjs command, separated by spaces. See Options for the jjs Command.
script-files
This represents one or more script files that you want to interpret using the Nashorn engine, separated by spaces. If no files are specified, then an interactive shell is started.
arguments
All values after the double hyphen marker (--) are passed through to the script or the interactive shell as arguments. These values can be accessed by using the arguments property.

The jjs command-line tool is used to invoke the Nashorn engine. You can use it to interpret one or several script files, or to run an interactive shell.

The options of the jjs command control the conditions under which scripts are interpreted by Nashorn engine.
-Dname=value
Sets a system property to be passed to the script by assigning a value to a property name. The following example shows how to invoke Nashorn engine in interactive mode and assign myValue to the property named myKey:

>> jjs -DmyKey=myValue
jjs> java.lang.System.getProperty("myKey")
myValue
jjs>

    

This option can be repeated to set multiple properties.

--add-modules modules
Specifies the root user Java modules.
-cp path or -classpath path
Specifies the path to the supporting class files. To set multiple paths, the option can be repeated, or you can separate each path with the following character:
Oracle Solaris, Linux, and OS X: Colon (:)
Windows: Semicolon (;)
-doe=[true|false] or -dump-on-error=[true|false]
Provides a full stack trace when an error occurs. By default, only a brief error message is printed. The default parameter is false.
-fv=[true|false] or -fullversion=[true|false]
Prints the full Nashorn version string. The default parameter is false.
-fx=[true|false]
Launches the script as a JavaFX application. The default parameter is false.

Note:

You must explicitly add the JavaFX modules to launch the script as a JavaFX application. The following example specifies the location of the JavaFX modules and adds them with the --module-path and --add-modules options:


jjs -fx --module-path /SOMEDIR/javafx-sdk-11/lib --add-modules javafx.controls HelloWorld.js

    

The following example uses the jlink command to create a custom runtime image that contains the JavaFX modules. The example then launches a script as a JavaFX application without specifying the JavaFX modules in the jjs command:


jlink --module-path /SOMEDIR/javafx-jmods-11 --add-modules jdk.scripting.nashorn,jdk.scripting.nashorn.shell,javafx.controls --output /SOMEDIR/myjdk
/SOMEDIR/myjdk/bin/jjs -fx HelloWorld.js

    

If you don't explicitly specify the JavaFX modules, then the jjs command prints a message and exits:


jjs -fx HelloWorld.js
JavaFX is not available.

    
-h or -help
Prints the list of options and their descriptions.
--language=[es5|es6]
Specifies the ECMAScript language version. The default version is ES5.
--module-path path
Specifies where to find user Java modules.
-ot=[true|false] or -optimistic-types=[true|false]
Enables or disables optimistic type assumptions with deoptimizing recompilation. This makes the compiler try, for any program symbol whose type can't be proven at compile time, to type it as narrowly and primitively as possible. If the runtime encounters an error because the symbol type is too narrow, then a wider method is generated until a steady stage is reached. While this produces as optimal Java bytecode as possible, erroneous type guesses will lead to longer warmup. Optimistic typing is currently enabled by default, but it can be disabled for faster startup performance. The default parameter is true.
-scripting=[true|false]
Enables a shell scripting features. The default parameter is true.
-strict=[true|false]
Enables a strict mode, which enforces stronger adherence to the standard (ECMAScript Edition 5.1), making it easier to detect common coding errors. The default parameter is false.
-t=zone or -timezone=zone
Sets the specified time zone for script execution. It overrides the time zone set in the OS and used by the Date object. The default zone is America/Los_Angeles.
-v=[true|false] or-version=[true|false]
Prints the Nashorn version string. The default parameter is false.


jjs script.js

    


>> jjs
jjs> println("Hello, World!")
Hello, World!
jjs> quit()
>>

    


>> jjs -- a b c
jjs> arguments.join(", ")
a, b, c
jjs>

    
2018 JDK 13

Search for    or go to Top of page |  Section 1 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.