Invokes the Nashorn engine.
jjs [options] [script-files] [-- arguments]
One or more options of the
jjs command, separated by spaces. For more information, see Options.
One or more script files which you want to interpret using Nashorn, separated by spaces. If no files are specified, an interactive shell is started.
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 (see Example 3).
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.
Sets the class cache size (in bytes). Append the letter
K to indicate kilobytes (KB),
M to indicate megabytes (MB),
G to indicate gigabytes (GB). By default, the class cache size is set to 50 bytes. The following example shows how to set it to 1024 bytes (1 KB):
Compiles the script without running it.
Specifies the path to the supporting class files To set multiple paths, the option can be repeated, or you can separate each path with a semicolon (;).
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 in interactive mode and assign
myValue to the property named
>> jjs -DmyKey=myValue jjs> java.lang.System.getProperty("myKey") myValue jjs>
This option can be repeated to set multiple properties.
Specifies the path to the directory where class files are dumped.
Generates a line number table in the class file. By default, this option is enabled. To disable it, specify
Generates a local variable table in the class file.
Provides a full stack trace when an error occurs. By default, only a brief error message is printed.
Reports invalid lvalue expressions as early errors (that is, when the code is parsed). By default, this option is enabled. To disable it, specify
--early-lvalue-error=false. When disabled, invalid lvalue expressions will not be reported until the code is executed.
Preserves empty statements in the Java abstract syntax tree.
Prints the full Nashorn version string.
Prints an error message when a function declaration is used as a statement.
Prints a warning message when a function declaration is used as a statement.
Launches the script as a JavaFX application.
Prints the list of options and their descriptions.
Passes the specified
java launcher option to the JVM. The following example shows how to invoke Nashorn in interactive mode and set the maximum memory used by the JVM to 4 GB:
>> jjs -J-Xmx4g jjs> java.lang.Runtime.getRuntime().maxMemory() 3817799680 jjs>
This option can be repeated to pass multiple
java command options.
Enables lazy code generation strategies (that is, the entire script is not compiled at once). This option is experimental.
Creates a new class loader per compile. By default, this option is enabled. To disable it, specify
Performs logging at a given level for the specified subsystems. You can specify logging levels for multiple subsystems separating them with commas. For example:
Specifies the package to which generated class files are added.
Parses the code without compiling.
Prints the abstract syntax tree.
Prints the lowered abstract syntax tree.
Prints the lowered parse tree.
--print* options to print the output on one line.
Prints the parse tree.
Prints the symbol table.
Dumps callsite profile data.
Enables shell scripting features.
Redirects the standard error stream to the specified file, stream (for example, to
stdout), or text terminal.
Redirects the standard output stream to the specified file, stream (for example, to
stderr), or text terminal.
Enables strict mode, which enforces stronger adherence to the standard (ECMAScript Edition 5.1), making it easier to detect common coding errors.
Sets the specified time zone for script execution. It overrides the time zone set in the OS and used by the
Enables callsite trace mode. Possible parameters are the following:
Trace callsite misses.
Trace callsite enter/exit.
Print object properties.
Verifies bytecode before running.
Prints the Nashorn version string.
Prints extended help for command-line options.
>> jjs jjs> println("Hello, World!") Hello, World! jjs> quit() >>
>> jjs -- a b c jjs> arguments.join(", ") a, b, c jjs>