< prev index next >

src/jdk.scripting.nashorn.shell/share/man/jjs.1

Print this page

        

*** 1,7 **** ! '\" t ! .\" Copyright (c) 1994, 2015, 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. --- 1,6 ---- ! .\" Copyright (c) 1994, 2019, 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.
*** 18,247 **** .\" .\" 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. .\" ! .\" Title: jjs ! .\" Language: English ! .\" Date: 03 March 2015 ! .\" SectDesc: Basic Tools ! .\" Software: JDK 8 ! .\" Arch: generic ! .\" Part Number: E38207-04 ! .\" Doc ID: JSSON ! .\" ! .if n .pl 99999 ! .TH "jjs" "1" "03 March 2015" "JDK 8" "Basic Tools" ! .\" ----------------------------------------------------------------- ! .\" * Define some portability stuff ! .\" ----------------------------------------------------------------- ! .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! .\" http://bugs.debian.org/507673 ! .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html ! .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! .ie \n(.g .ds Aq \(aq ! .el .ds Aq ' ! .\" ----------------------------------------------------------------- ! .\" * set default formatting ! .\" ----------------------------------------------------------------- ! .\" disable hyphenation ! .nh ! .\" disable justification (adjust text to left margin only) ! .ad l ! .\" ----------------------------------------------------------------- ! .\" * MAIN CONTENT STARTS HERE * ! .\" ----------------------------------------------------------------- ! .SH "NAME" ! jjs \- Invokes the Nashorn engine\&. ! .SH "SYNOPSIS" ! .sp ! .if n \{\ ! .RS 4 ! .\} ! .nf ! \fB\fBjjs\fR\fR\fB [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIscript\-files\fR\fR\fB] [\-\- \fR\fB\fIarguments\fR\fR\fB]\fR ! .fi ! .if n \{\ ! .RE ! .\} ! .PP ! \fIoptions\fR ! .RS 4 ! One or more options of the ! \fBjjs\fR ! command, separated by spaces\&. For more information, see Options\&. ! .RE ! .PP ! \fIscript\-files\fR ! .RS 4 ! 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\&. ! .RE ! .PP ! \fIarguments\fR ! .RS 4 ! All values after the double hyphen marker (\fB\-\-\fR) are passed through to the script or the interactive shell as arguments\&. These values can be accessed by using the ! \fBarguments\fR ! property (see Example 3)\&. ! .RE ! .SH "DESCRIPTION" ! .PP ! The ! \fBjjs\fR ! 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\&. ! .SH "OPTIONS" ! .PP ! The options of the ! \fBjjs\fR ! command control the conditions under which scripts are interpreted by Nashorn\&. ! .PP ! \-cp \fIpath\fR ! .br ! \-classpath \fIpath\fR ! .RS 4 ! 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 (:)\&. ! .RE ! .PP ! \-D\fIname\fR=\fIvalue\fR ! .RS 4 ! 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 ! \fBmyValue\fR ! to the property named ! \fBmyKey\fR: ! .sp ! .if n \{\ ! .RS 4 ! .\} ! .nf ! \fB>> \fR\fB\fBjjs \-DmyKey=myValue\fR\fR ! \fBjjs> \fR\fB\fBjava\&.lang\&.System\&.getProperty("myKey")\fR\fR ! \fBmyValue\fR ! \fBjjs>\fR ! .fi - .if n \{\ - .RE - .\} - This option can be repeated to set multiple properties\&. - .RE - .PP - \-doe - .br - \-\-dump\-on\-error - .RS 4 - Provides a full stack trace when an error occurs\&. By default, only a brief error message is printed\&. - .RE - .PP - \-fv - .br - \-\-fullversion - .RS 4 - Prints the full Nashorn version string\&. - .RE - .PP - \-fx - .RS 4 - Launches the script as a JavaFX application\&. - .RE - .PP - \-h - .br - \-help - .RS 4 - Prints the list of options and their descriptions\&. - .RE - .PP - \-\-language=[es5] - .RS 4 - Specifies the ECMAScript language version\&. The default version is ES5\&. - .RE - .PP - \-ot - .br - \-\-optimistic\-types=[true|false] - .RS 4 - Enables or disables optimistic type assumptions with deoptimizing recompilation\&. Running with optimistic types will yield higher final speed, but may increase warmup time\&. - .RE - .PP - \-scripting - .RS 4 - Enables shell scripting features\&. - .RE .PP ! \-strict ! .RS 4 ! Enables strict mode, which enforces stronger adherence to the standard (ECMAScript Edition 5\&.1), making it easier to detect common coding errors\&. .RE ! .PP ! \-t=\fIzone\fR ! .br ! \-timezone=\fIzone\fR ! .RS 4 ! Sets the specified time zone for script execution\&. It overrides the time zone set in the OS and used by the ! \fBDate\fR ! object\&. ! .RE ! .PP ! \-v ! .br ! \-version ! .RS 4 ! Prints the Nashorn version string\&. ! .RE ! .SH "EXAMPLES" ! .PP ! \fBExample 1 \fRRunning a Script with Nashorn ! .RS 4 ! .sp ! .if n \{\ ! .RS 4 ! .\} .nf ! \fBjjs script\&.js\fR ! .fi - .if n \{\ - .RE - .\} - .RE .PP ! \fBExample 2 \fRRunning Nashorn in Interactive Mode ! .RS 4 ! .sp ! .if n \{\ ! .RS 4 ! .\} ! .nf ! \fB>> \fR\fB\fBjjs\fR\fR ! \fBjjs> \fR\fB\fBprintln("Hello, World!")\fR\fR ! \fBHello, World!\fR ! \fBjjs> \fR\fB\fBquit()\fR\fR ! \fB>>\fR .fi - .if n \{\ - .RE - .\} - .RE .PP ! \fBExample 3 \fRPassing Arguments to Nashorn ! .RS 4 ! .sp ! .if n \{\ ! .RS 4 ! .\} ! .nf ! \fB>> \fR\fB\fBjjs \-\- a b c\fR\fR ! \fBjjs> \fR\fB\fBarguments\&.join(", ")\fR\fR ! \fBa, b, c\fR ! \fBjjs>\fR .fi - .if n \{\ .RE ! .\} .RE ! .SH "SEE ALSO" ! .PP ! \fBjrunscript\fR ! .br ! 'pl 8.5i ! 'bp --- 17,247 ---- .\" .\" 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. .\" ! .\" Automatically generated by Pandoc 2.3.1 ! .\" ! .TH "JJS" "1" "2018" "JDK 13" "JDK Commands" ! .hy ! .SH NAME ! .PP ! jjs \- command\-line tool to invoke the Nashorn engine ! .SH SYNOPSIS ! .PP ! \f[B]Note:\f[R] The \f[CB]jjs\f[R] tool and the Nashorn engine are ! deprecated in JDK 11 in preparation for removal in a future release. ! .PP ! \f[CB]jjs\f[R] [\f[I]options\f[R]] \f[I]script\-files\f[R] [\f[CB]\-\-\f[R] ! \f[I]arguments\f[R]] ! .TP ! .B \f[I]options\f[R] ! This represents one or more options of the \f[CB]jjs\f[R] command, ! separated by spaces. ! See \f[B]Options for the jjs Command\f[R]. ! .RS ! .RE ! .TP ! .B \f[I]script\-files\f[R] ! 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. ! .RS ! .RE ! .TP ! .B \f[I]arguments\f[R] ! All values after the double hyphen marker (\f[CB]\-\-\f[R]) are passed ! through to the script or the interactive shell as arguments. ! These values can be accessed by using the \f[CB]arguments\f[R] property. ! .RS ! .RE ! .SH DESCRIPTION ! .PP ! The \f[CB]jjs\f[R] 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. ! .SH OPTIONS FOR THE JJS COMMAND ! .PP ! The options of the \f[CB]jjs\f[R] command control the conditions under ! which scripts are interpreted by Nashorn engine. ! .TP ! .B \f[CB]\-D\f[R]\f[I]name\f[R]\f[CB]=\f[R]\f[I]value\f[R] ! 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 \f[CB]myValue\f[R] to the property named \f[CB]myKey\f[R]: ! .RS ! .IP ! .nf ! \f[CB] ! >>\ jjs\ \-DmyKey=myValue ! jjs>\ java.lang.System.getProperty("myKey") ! myValue ! jjs> ! \f[R] .fi .PP ! This option can be repeated to set multiple properties. .RE ! .TP ! .B \f[CB]\-\-add\-modules\f[R] \f[I]modules\f[R] ! Specifies the root user Java modules. ! .RS ! .RE ! .TP ! .B \f[CB]\-cp\f[R] \f[I]path\f[R] or \f[CB]\-classpath\f[R] \f[I]path\f[R] ! 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: ! .RS ! .IP \[bu] 2 ! \f[B]Oracle Solaris, Linux, and OS X:\f[R] Colon (\f[CB]:\f[R]) ! .IP \[bu] 2 ! \f[B]Windows:\f[R] Semicolon (\f[CB];\f[R]) ! .RE ! .TP ! .B \f[CB]\-doe=\f[R][\f[CB]true\f[R]|\f[CB]false\f[R]] or \f[CB]\-dump\-on\-error=\f[R][\f[CB]true\f[R]|\f[CB]false\f[R]] ! Provides a full stack trace when an error occurs. ! By default, only a brief error message is printed. ! The default parameter is \f[CB]false\f[R]. ! .RS ! .RE ! .TP ! .B \f[CB]\-fv=\f[R][\f[CB]true\f[R]|\f[CB]false\f[R]] or \f[CB]\-fullversion=\f[R][\f[CB]true\f[R]|\f[CB]false\f[R]] ! Prints the full Nashorn version string. ! The default parameter is \f[CB]false\f[R]. ! .RS ! .RE ! .TP ! .B \f[CB]\-fx=\f[R][\f[CB]true\f[R]|\f[CB]false\f[R]] ! Launches the script as a JavaFX application. ! The default parameter is \f[CB]false\f[R]. ! .RS ! .PP ! \f[B]Note:\f[R] ! .PP ! 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 \f[CB]\-\-module\-path\f[R] and ! \f[CB]\-\-add\-modules\f[R] options: ! .IP .nf ! \f[CB] ! jjs\ \-fx\ \-\-module\-path\ /SOMEDIR/javafx\-sdk\-11/lib\ \-\-add\-modules\ javafx.controls\ HelloWorld.js ! \f[R] .fi .PP ! The following example uses the \f[CB]jlink\f[R] 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 \f[CB]jjs\f[R] command: ! .IP ! .nf ! \f[CB] ! 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 + \f[R] .fi .PP ! If you don\[aq]t explicitly specify the JavaFX modules, then the ! \f[CB]jjs\f[R] command prints a message and exits: ! .IP ! .nf ! \f[CB] ! jjs\ \-fx\ HelloWorld.js + JavaFX\ is\ not\ available. + \f[R] .fi .RE ! .TP ! .B \f[CB]\-h\f[R] or \f[CB]\-help\f[R] ! Prints the list of options and their descriptions. ! .RS ! .RE ! .TP ! .B \f[CB]\-\-language=\f[R][\f[CB]es5\f[R]|\f[CB]es6\f[R]] ! Specifies the ECMAScript language version. ! The default version is ES5. ! .RS ! .RE ! .TP ! .B \f[CB]\-\-module\-path\f[R] \f[I]path\f[R] ! Specifies where to find user Java modules. ! .RS ! .RE ! .TP ! .B \f[CB]\-ot=\f[R][\f[CB]true\f[R]|\f[CB]false\f[R]] or \f[CB]\-optimistic\-types=\f[R][\f[CB]true\f[R]|\f[CB]false\f[R]] ! Enables or disables optimistic type assumptions with deoptimizing ! recompilation. ! This makes the compiler try, for any program symbol whose type can\[aq]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 \f[CB]true\f[R]. ! .RS ! .RE ! .TP ! .B \f[CB]\-scripting=\f[R][\f[CB]true\f[R]|\f[CB]false\f[R]] ! Enables a shell scripting features. ! The default parameter is \f[CB]true\f[R]. ! .RS ! .RE ! .TP ! .B \f[CB]\-strict=\f[R][\f[CB]true\f[R]|\f[CB]false\f[R]] ! 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 \f[CB]false\f[R]. ! .RS ! .RE ! .TP ! .B \f[CB]\-t=\f[R]\f[I]zone\f[R] or \f[CB]\-timezone=\f[R]\f[I]zone\f[R] ! Sets the specified time zone for script execution. ! It overrides the time zone set in the OS and used by the \f[CB]Date\f[R] ! object. ! The default \f[I]zone\f[R] is \f[CB]America/Los_Angeles\f[R]. ! .RS ! .RE ! .TP ! .B \f[CB]\-v=\f[R][\f[CB]true\f[R]|\f[CB]false\f[R]] or\f[CB]\-version=\f[R][\f[CB]true\f[R]|\f[CB]false\f[R]] ! Prints the Nashorn version string. ! The default parameter is \f[CB]false\f[R]. ! .RS .RE ! .SH EXAMPLE OF RUNNING A SCRIPT WITH NASHORN ! .IP ! .nf ! \f[CB] ! jjs\ script.js ! \f[R] ! .fi ! .SH EXAMPLE OF RUNNING NASHORN IN INTERACTIVE MODE ! .IP ! .nf ! \f[CB] ! >>\ jjs ! jjs>\ println("Hello,\ World!") ! Hello,\ World! ! jjs>\ quit() ! >> ! \f[R] ! .fi ! .SH EXAMPLE OF PASSING ARGUMENTS TO NASHORN ! .IP ! .nf ! \f[CB] ! >>\ jjs\ \-\-\ a\ b\ c ! jjs>\ arguments.join(",\ ") ! a,\ b,\ c ! jjs> ! \f[R] ! .fi
< prev index next >