1 '\" t 2 .\" Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved. 3 .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 .\" 5 .\" This code is free software; you can redistribute it and/or modify it 6 .\" under the terms of the GNU General Public License version 2 only, as 7 .\" published by the Free Software Foundation. 8 .\" 9 .\" This code is distributed in the hope that it will be useful, but WITHOUT 10 .\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 .\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 .\" version 2 for more details (a copy is included in the LICENSE file that 13 .\" accompanied this code). 14 .\" 15 .\" You should have received a copy of the GNU General Public License version 16 .\" 2 along with this work; if not, write to the Free Software Foundation, 17 .\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 .\" 19 .\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 .\" or visit www.oracle.com if you need additional information or have any 21 .\" questions. 22 .\" 23 .\" Title: jjs 24 .\" Language: English 25 .\" Date: 03 March 2015 26 .\" SectDesc: Basic Tools 27 .\" Software: JDK 8 28 .\" Arch: generic 29 .\" Part Number: E38207-04 30 .\" Doc ID: JSSON 31 .\" 32 .if n .pl 99999 33 .TH "jjs" "1" "03 March 2015" "JDK 8" "Basic Tools" 34 .\" ----------------------------------------------------------------- 35 .\" * Define some portability stuff 36 .\" ----------------------------------------------------------------- 37 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 38 .\" http://bugs.debian.org/507673 39 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html 40 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 41 .ie \n(.g .ds Aq \(aq 42 .el .ds Aq ' 43 .\" ----------------------------------------------------------------- 44 .\" * set default formatting 45 .\" ----------------------------------------------------------------- 46 .\" disable hyphenation 47 .nh 48 .\" disable justification (adjust text to left margin only) 49 .ad l 50 .\" ----------------------------------------------------------------- 51 .\" * MAIN CONTENT STARTS HERE * 52 .\" ----------------------------------------------------------------- 53 .SH "NAME" 54 jjs \- Invokes the Nashorn engine\&. 55 .SH "SYNOPSIS" 56 .sp 57 .if n \{\ 58 .RS 4 59 .\} 60 .nf 61 \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 62 .fi 63 .if n \{\ 64 .RE 65 .\} 66 .PP 67 \fIoptions\fR 68 .RS 4 69 One or more options of the 70 \fBjjs\fR 71 command, separated by spaces\&. For more information, see Options\&. 72 .RE 73 .PP 74 \fIscript\-files\fR 75 .RS 4 76 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\&. 77 .RE 78 .PP 79 \fIarguments\fR 80 .RS 4 81 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 82 \fBarguments\fR 83 property (see Example 3)\&. 84 .RE 85 .SH "DESCRIPTION" 86 .PP 87 The 88 \fBjjs\fR 89 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\&. 90 .SH "OPTIONS" 91 .PP 92 The options of the 93 \fBjjs\fR 94 command control the conditions under which scripts are interpreted by Nashorn\&. 95 .PP 96 \-cp \fIpath\fR 97 .br 98 \-classpath \fIpath\fR 99 .RS 4 100 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 (:)\&. 101 .RE 102 .PP 103 \-D\fIname\fR=\fIvalue\fR 104 .RS 4 105 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 106 \fBmyValue\fR 107 to the property named 108 \fBmyKey\fR: 109 .sp 110 .if n \{\ 111 .RS 4 112 .\} 113 .nf 114 \fB>> \fR\fB\fBjjs \-DmyKey=myValue\fR\fR 115 \fBjjs> \fR\fB\fBjava\&.lang\&.System\&.getProperty("myKey")\fR\fR 116 \fBmyValue\fR 117 \fBjjs>\fR 118 119 .fi 120 .if n \{\ 121 .RE 122 .\} 123 This option can be repeated to set multiple properties\&. 124 .RE 125 .PP 126 \-doe 127 .br 128 \-\-dump\-on\-error 129 .RS 4 130 Provides a full stack trace when an error occurs\&. By default, only a brief error message is printed\&. 131 .RE 132 .PP 133 \-fv 134 .br 135 \-\-fullversion 136 .RS 4 137 Prints the full Nashorn version string\&. 138 .RE 139 .PP 140 \-fx 141 .RS 4 142 Launches the script as a JavaFX application\&. 143 .RE 144 .PP 145 \-h 146 .br 147 \-help 148 .RS 4 149 Prints the list of options and their descriptions\&. 150 .RE 151 .PP 152 \-\-language=[es5] 153 .RS 4 154 Specifies the ECMAScript language version\&. The default version is ES5\&. 155 .RE 156 .PP 157 \-ot 158 .br 159 \-\-optimistic\-types=[true|false] 160 .RS 4 161 Enables or disables optimistic type assumptions with deoptimizing recompilation\&. Running with optimistic types will yield higher final speed, but may increase warmup time\&. 162 .RE 163 .PP 164 \-scripting 165 .RS 4 166 Enables shell scripting features\&. 167 .RE 168 .PP 169 \-strict 170 .RS 4 171 Enables strict mode, which enforces stronger adherence to the standard (ECMAScript Edition 5\&.1), making it easier to detect common coding errors\&. 172 .RE 173 .PP 174 \-t=\fIzone\fR 175 .br 176 \-timezone=\fIzone\fR 177 .RS 4 178 Sets the specified time zone for script execution\&. It overrides the time zone set in the OS and used by the 179 \fBDate\fR 180 object\&. 181 .RE 182 .PP 183 \-v 184 .br 185 \-version 186 .RS 4 187 Prints the Nashorn version string\&. 188 .RE 189 .SH "EXAMPLES" 190 .PP 191 \fBExample 1 \fRRunning a Script with Nashorn 192 .RS 4 193 .sp 194 .if n \{\ 195 .RS 4 196 .\} 197 .nf 198 \fBjjs script\&.js\fR 199 200 .fi 201 .if n \{\ 202 .RE 203 .\} 204 .RE 205 .PP 206 \fBExample 2 \fRRunning Nashorn in Interactive Mode 207 .RS 4 208 .sp 209 .if n \{\ 210 .RS 4 211 .\} 212 .nf 213 \fB>> \fR\fB\fBjjs\fR\fR 214 \fBjjs> \fR\fB\fBprintln("Hello, World!")\fR\fR 215 \fBHello, World!\fR 216 \fBjjs> \fR\fB\fBquit()\fR\fR 217 \fB>>\fR 218 219 .fi 220 .if n \{\ 221 .RE 222 .\} 223 .RE 224 .PP 225 \fBExample 3 \fRPassing Arguments to Nashorn 226 .RS 4 227 .sp 228 .if n \{\ 229 .RS 4 230 .\} 231 .nf 232 \fB>> \fR\fB\fBjjs \-\- a b c\fR\fR 233 \fBjjs> \fR\fB\fBarguments\&.join(", ")\fR\fR 234 \fBa, b, c\fR 235 \fBjjs>\fR 236 237 .fi 238 .if n \{\ 239 .RE 240 .\} 241 .RE 242 .SH "SEE ALSO" 243 .PP 244 \fBjrunscript\fR 245 .br 246 'pl 8.5i 247 'bp | 1 .\" Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved. 2 .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 .\" 4 .\" This code is free software; you can redistribute it and/or modify it 5 .\" under the terms of the GNU General Public License version 2 only, as 6 .\" published by the Free Software Foundation. 7 .\" 8 .\" This code is distributed in the hope that it will be useful, but WITHOUT 9 .\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 .\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11 .\" version 2 for more details (a copy is included in the LICENSE file that 12 .\" accompanied this code). 13 .\" 14 .\" You should have received a copy of the GNU General Public License version 15 .\" 2 along with this work; if not, write to the Free Software Foundation, 16 .\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17 .\" 18 .\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 .\" or visit www.oracle.com if you need additional information or have any 20 .\" questions. 21 .\" 22 .\" Automatically generated by Pandoc 2.3.1 23 .\" 24 .TH "JJS" "1" "2018" "JDK 13" "JDK Commands" 25 .hy 26 .SH NAME 27 .PP 28 jjs \- command\-line tool to invoke the Nashorn engine 29 .SH SYNOPSIS 30 .PP 31 \f[B]Note:\f[R] The \f[CB]jjs\f[R] tool and the Nashorn engine are 32 deprecated in JDK 11 in preparation for removal in a future release. 33 .PP 34 \f[CB]jjs\f[R] [\f[I]options\f[R]] \f[I]script\-files\f[R] [\f[CB]\-\-\f[R] 35 \f[I]arguments\f[R]] 36 .TP 37 .B \f[I]options\f[R] 38 This represents one or more options of the \f[CB]jjs\f[R] command, 39 separated by spaces. 40 See \f[B]Options for the jjs Command\f[R]. 41 .RS 42 .RE 43 .TP 44 .B \f[I]script\-files\f[R] 45 This represents one or more script files that you want to interpret 46 using the Nashorn engine, separated by spaces. 47 If no files are specified, then an interactive shell is started. 48 .RS 49 .RE 50 .TP 51 .B \f[I]arguments\f[R] 52 All values after the double hyphen marker (\f[CB]\-\-\f[R]) are passed 53 through to the script or the interactive shell as arguments. 54 These values can be accessed by using the \f[CB]arguments\f[R] property. 55 .RS 56 .RE 57 .SH DESCRIPTION 58 .PP 59 The \f[CB]jjs\f[R] command\-line tool is used to invoke the Nashorn 60 engine. 61 You can use it to interpret one or several script files, or to run an 62 interactive shell. 63 .SH OPTIONS FOR THE JJS COMMAND 64 .PP 65 The options of the \f[CB]jjs\f[R] command control the conditions under 66 which scripts are interpreted by Nashorn engine. 67 .TP 68 .B \f[CB]\-D\f[R]\f[I]name\f[R]\f[CB]=\f[R]\f[I]value\f[R] 69 Sets a system property to be passed to the script by assigning a value 70 to a property name. 71 The following example shows how to invoke Nashorn engine in interactive 72 mode and assign \f[CB]myValue\f[R] to the property named \f[CB]myKey\f[R]: 73 .RS 74 .IP 75 .nf 76 \f[CB] 77 >>\ jjs\ \-DmyKey=myValue 78 jjs>\ java.lang.System.getProperty("myKey") 79 myValue 80 jjs> 81 \f[R] 82 .fi 83 .PP 84 This option can be repeated to set multiple properties. 85 .RE 86 .TP 87 .B \f[CB]\-\-add\-modules\f[R] \f[I]modules\f[R] 88 Specifies the root user Java modules. 89 .RS 90 .RE 91 .TP 92 .B \f[CB]\-cp\f[R] \f[I]path\f[R] or \f[CB]\-classpath\f[R] \f[I]path\f[R] 93 Specifies the path to the supporting class files. 94 To set multiple paths, the option can be repeated, or you can separate 95 each path with the following character: 96 .RS 97 .IP \[bu] 2 98 \f[B]Oracle Solaris, Linux, and OS X:\f[R] Colon (\f[CB]:\f[R]) 99 .IP \[bu] 2 100 \f[B]Windows:\f[R] Semicolon (\f[CB];\f[R]) 101 .RE 102 .TP 103 .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]] 104 Provides a full stack trace when an error occurs. 105 By default, only a brief error message is printed. 106 The default parameter is \f[CB]false\f[R]. 107 .RS 108 .RE 109 .TP 110 .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]] 111 Prints the full Nashorn version string. 112 The default parameter is \f[CB]false\f[R]. 113 .RS 114 .RE 115 .TP 116 .B \f[CB]\-fx=\f[R][\f[CB]true\f[R]|\f[CB]false\f[R]] 117 Launches the script as a JavaFX application. 118 The default parameter is \f[CB]false\f[R]. 119 .RS 120 .PP 121 \f[B]Note:\f[R] 122 .PP 123 You must explicitly add the JavaFX modules to launch the script as a 124 JavaFX application. 125 The following example specifies the location of the JavaFX modules and 126 adds them with the \f[CB]\-\-module\-path\f[R] and 127 \f[CB]\-\-add\-modules\f[R] options: 128 .IP 129 .nf 130 \f[CB] 131 jjs\ \-fx\ \-\-module\-path\ /SOMEDIR/javafx\-sdk\-11/lib\ \-\-add\-modules\ javafx.controls\ HelloWorld.js 132 \f[R] 133 .fi 134 .PP 135 The following example uses the \f[CB]jlink\f[R] command to create a custom 136 runtime image that contains the JavaFX modules. 137 The example then launches a script as a JavaFX application without 138 specifying the JavaFX modules in the \f[CB]jjs\f[R] command: 139 .IP 140 .nf 141 \f[CB] 142 jlink\ \-\-module\-path\ /SOMEDIR/javafx\-jmods\-11\ \-\-add\-modules\ jdk.scripting.nashorn,jdk.scripting.nashorn.shell,javafx.controls\ \-\-output\ /SOMEDIR/myjdk 143 144 /SOMEDIR/myjdk/bin/jjs\ \-fx\ HelloWorld.js 145 \f[R] 146 .fi 147 .PP 148 If you don\[aq]t explicitly specify the JavaFX modules, then the 149 \f[CB]jjs\f[R] command prints a message and exits: 150 .IP 151 .nf 152 \f[CB] 153 jjs\ \-fx\ HelloWorld.js 154 155 JavaFX\ is\ not\ available. 156 \f[R] 157 .fi 158 .RE 159 .TP 160 .B \f[CB]\-h\f[R] or \f[CB]\-help\f[R] 161 Prints the list of options and their descriptions. 162 .RS 163 .RE 164 .TP 165 .B \f[CB]\-\-language=\f[R][\f[CB]es5\f[R]|\f[CB]es6\f[R]] 166 Specifies the ECMAScript language version. 167 The default version is ES5. 168 .RS 169 .RE 170 .TP 171 .B \f[CB]\-\-module\-path\f[R] \f[I]path\f[R] 172 Specifies where to find user Java modules. 173 .RS 174 .RE 175 .TP 176 .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]] 177 Enables or disables optimistic type assumptions with deoptimizing 178 recompilation. 179 This makes the compiler try, for any program symbol whose type can\[aq]t 180 be proven at compile time, to type it as narrowly and primitively as 181 possible. 182 If the runtime encounters an error because the symbol type is too 183 narrow, then a wider method is generated until a steady stage is 184 reached. 185 While this produces as optimal Java bytecode as possible, erroneous type 186 guesses will lead to longer warmup. 187 Optimistic typing is currently enabled by default, but it can be 188 disabled for faster startup performance. 189 The default parameter is \f[CB]true\f[R]. 190 .RS 191 .RE 192 .TP 193 .B \f[CB]\-scripting=\f[R][\f[CB]true\f[R]|\f[CB]false\f[R]] 194 Enables a shell scripting features. 195 The default parameter is \f[CB]true\f[R]. 196 .RS 197 .RE 198 .TP 199 .B \f[CB]\-strict=\f[R][\f[CB]true\f[R]|\f[CB]false\f[R]] 200 Enables a strict mode, which enforces stronger adherence to the standard 201 (ECMAScript Edition 5.1), making it easier to detect common coding 202 errors. 203 The default parameter is \f[CB]false\f[R]. 204 .RS 205 .RE 206 .TP 207 .B \f[CB]\-t=\f[R]\f[I]zone\f[R] or \f[CB]\-timezone=\f[R]\f[I]zone\f[R] 208 Sets the specified time zone for script execution. 209 It overrides the time zone set in the OS and used by the \f[CB]Date\f[R] 210 object. 211 The default \f[I]zone\f[R] is \f[CB]America/Los_Angeles\f[R]. 212 .RS 213 .RE 214 .TP 215 .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]] 216 Prints the Nashorn version string. 217 The default parameter is \f[CB]false\f[R]. 218 .RS 219 .RE 220 .SH EXAMPLE OF RUNNING A SCRIPT WITH NASHORN 221 .IP 222 .nf 223 \f[CB] 224 jjs\ script.js 225 \f[R] 226 .fi 227 .SH EXAMPLE OF RUNNING NASHORN IN INTERACTIVE MODE 228 .IP 229 .nf 230 \f[CB] 231 >>\ jjs 232 jjs>\ println("Hello,\ World!") 233 Hello,\ World! 234 jjs>\ quit() 235 >> 236 \f[R] 237 .fi 238 .SH EXAMPLE OF PASSING ARGUMENTS TO NASHORN 239 .IP 240 .nf 241 \f[CB] 242 >>\ jjs\ \-\-\ a\ b\ c 243 jjs>\ arguments.join(",\ ") 244 a,\ b,\ c 245 jjs> 246 \f[R] 247 .fi |