jjs.1 revision 8813:66c98bd811f1
t
Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.

DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.

This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).

You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.

Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.

Arch: generic
Software: JDK 8
Date: 21 November 2013
SectDesc: Basic Tools
Title: jjs.1

jjs 1 "21 November 2013" "JDK 8" "Basic Tools"
-----------------------------------------------------------------
* Define some portability stuff
-----------------------------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://bugs.debian.org/507673
http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----------------------------------------------------------------
* set default formatting
-----------------------------------------------------------------
disable hyphenation
disable justification (adjust text to left margin only)
-----------------------------------------------------------------
* MAIN CONTENT STARTS HERE *
-----------------------------------------------------------------
NAME
jjs - Invokes the Nashorn engine.
SYNOPSIS
 
\f3jjs [options] [script-files] [-- arguments]

options One or more options of the \f3jjs command, separated by spaces. For more information, see Options.

script-files 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.

arguments All values after the double hyphen marker (\f3--) are passed through to the script or the interactive shell as arguments. These values can be accessed by using the \f3arguments property (see ).

DESCRIPTION
The \f3jjs 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.
OPTIONS
The options of the \f3jjs command control the conditions under which scripts are interpreted by Nashorn.

-ccs=size , --class-cache-size=size

Sets the class cache size (in bytes). Append the letter \f3k or \f3K to indicate kilobytes (KB), \f3m or \f3M to indicate megabytes (MB), \f3g or \f3G 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):

 
\f3-css=100
 
\f3-css=1k
 
\f3

-co, --compile-only

Compiles the script without running it.

-cp path , --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 a colon (:).

-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 in interactive mode and assign \f3myValue to the property named \f3myKey:

 
\f3>> jjs -DmyKey=myValue
 
\f3jjs> java.lang.System.getProperty("myKey")
 
\f3myValue
 
\f3jjs>
 
\f3
This option can be repeated to set multiple properties.

-d=path , --dump-debug-dir=path

Specifies the path to the directory where class files are dumped.

--debug-lines

Generates a line number table in the class file. By default, this option is enabled. To disable it, specify \f3--debug-lines=false.

--debug-locals

Generates a local variable table in the class file.

-doe, --dump-on-error

Provides a full stack trace when an arror occurs. By default, only a brief error message is printed.

--early-lvalue-error

Reports invalid lvalue expressions as early errors (that is, when the code is parsed). By default, this option is enabled. To disable it, specify \f3--early-lvalue-error=false. When disabled, invalid lvalue expressions will not be reported until the code is executed.

--empty-statements

Preserves empty statements in the Java abstract syntax tree.

-fv, --fullversion

Prints the full Nashorn version string.

--function-statement-error

Prints an error message when a function declaration is used as a statement.

--function-statement-warning

Prints a warning message when a function declaration is used as a statement.

-fx

Launches the script as a JavaFX application.

-h, -help

Prints the list of options and their descriptions.

-Joption

Passes the specified \f3java 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:

 
\f3>> jjs -J-Xmx4g
 
\f3jjs> java.lang.Runtime.getRuntime().maxMemory()
 
\f33817799680
 
\f3jjs>
 
\f3
This option can be repeated to pass multiple \f3java command options.

--lazy-compilation

Enables lazy code generation strategies (that is, the entire script is not compiled at once). This option is experimental.

--loader-per-compile

Creates a new class loader per compile. By default, this option is enabled. To disable it, specify \f3--loader-per-compile=false.

--log=subsystem:level

Performs logging at a given level for the specified subsystems. You can specify logging levels for multiple subsystems separating them with commas. For example:

 
\f3--log=fields:finest,codegen:info
 
\f3

--package=name

Specifies the package to which generated class files are added.

--parse-only

Parses the code without compiling.

--print-ast

Prints the abstract syntax tree.

--print-code

Prints bytecode.

--print-lower-ast

Prints the lowered abstract syntax tree.

--print-lower-parse

Prints the lowered parse tree.

--print-no-newline

Forces other \f3--print* options to print the output on one line.

--print-parse

Prints the parse tree.

--print-symbols

Prints the symbol table.

-pcs, --profile-callsites

Dumps callsite profile data.

-scripting

Enables shell scripting features.

--stderr=filename|stream|tty

Redirects the standard error stream to the specified file, stream (for example, to \f3stdout), or text terminal.

--stdout=filename|stream|tty

Redirects the standard output stream to the specified file, stream (for example, to \f3stderr), or text terminal.

-strict

Enables strict mode, which enforces stronger adherence to the standard (ECMAScript Edition 5.1), making it easier to detect common coding errors.

-t=zone , -timezone=zone

Sets the specified time zone for script execution. It overrides the time zone set in the OS and used by the \f3Date object.

-tcs=parameter , --trace-callsites=parameter

Enables callsite trace mode. Possible parameters are the following:

miss Trace callsite misses.

enterexit Trace callsite enter/exit.

objects Print object properties.

--verify-code

Verifies bytecode before running.

-v, -version

Prints the Nashorn version string.

-xhelp

Prints extended help for command-line options.

EXAMPLES
\f3Example 1 Running a Script with Nashorn
 
\f3jjs script.js
 
\f3
\f3Example 2 Running Nashorn in Interactive Mode
 
\f3>> jjs
 
\f3jjs> println("Hello, World!")
 
\f3Hello, World!
 
\f3jjs> quit()
 
\f3>>
 
\f3
\f3Example 3 Passing Arguments to Nashorn
 
\f3>> jjs -- a b c
 
\f3jjs> arguments.join(", ")
 
\f3a, b, c
 
\f3jjs>
 
\f3
SEE ALSO
\f3jrunscript

'pl 8.5i 'bp