1 '\" t 2 .\" Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved. 3 .\" 4 .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 .\" 6 .\" This code is free software; you can redistribute it and/or modify it 7 .\" under the terms of the GNU General Public License version 2 only, as 8 .\" published by the Free Software Foundation. 9 .\" 10 .\" This code is distributed in the hope that it will be useful, but WITHOUT 11 .\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 .\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 .\" version 2 for more details (a copy is included in the LICENSE file that 14 .\" accompanied this code). 15 .\" 16 .\" You should have received a copy of the GNU General Public License version 17 .\" 2 along with this work; if not, write to the Free Software Foundation, 18 .\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 .\" 20 .\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 .\" or visit www.oracle.com if you need additional information or have any 22 .\" questions. 23 .\" 24 .\" Arch: generic 25 .\" Software: JDK 8 26 .\" Date: 03 March 2015 27 .\" SectDesc: Basic Tools 28 .\" Title: jjs.1 29 .\" 30 .if n .pl 99999 31 .TH jjs 1 "03 March 2015" "JDK 8" "Basic Tools" 32 .\" ----------------------------------------------------------------- 33 .\" * Define some portability stuff 34 .\" ----------------------------------------------------------------- 35 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 36 .\" http://bugs.debian.org/507673 37 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html 38 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 39 .ie \n(.g .ds Aq \(aq 40 .el .ds Aq ' 41 .\" ----------------------------------------------------------------- 42 .\" * set default formatting 43 .\" ----------------------------------------------------------------- 44 .\" disable hyphenation 45 .nh 46 .\" disable justification (adjust text to left margin only) 47 .ad l 48 .\" ----------------------------------------------------------------- 49 .\" * MAIN CONTENT STARTS HERE * 50 .\" ----------------------------------------------------------------- 51 52 .SH NAME 53 jjs \- Invokes the Nashorn engine\&. 54 .SH SYNOPSIS 55 .sp 56 .nf 57 \f3\fBjjs\fR [\fIoptions\fR] [\fIscript\-files\fR] [\-\- \fIarguments\fR]\fP 58 .fi 59 .sp 60 .TP 61 \fIoptions\fR 62 One or more options of the \f3jjs\fR command, separated by spaces\&. For more information, see Options\&. 63 .TP 64 \fIscript-files\fR 65 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\&. 66 .TP 67 \fIarguments\fR 68 All values after the double hyphen marker (\f3--\fR) are passed through to the script or the interactive shell as arguments\&. These values can be accessed by using the \f3arguments\fR property (see )\&. 69 .SH DESCRIPTION 70 The \f3jjs\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\&. 71 .SH OPTIONS 72 The options of the \f3jjs\fR command control the conditions under which scripts are interpreted by Nashorn\&. 73 .TP 74 -ccs=\fIsize\fR , --class-cache-size=\fIsize\fR 75 .br 76 Sets the class cache size (in bytes)\&. Append the letter \f3k\fR or \f3K\fR to indicate kilobytes (KB), \f3m\fR or \f3M\fR to indicate megabytes (MB), \f3g\fR or \f3G\fR 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): 77 .sp 78 .nf 79 \f3\-css=100\fP 80 .fi 81 .nf 82 \f3\-css=1k\fP 83 .fi 84 .nf 85 \f3\fP 86 .fi 87 .sp 88 89 .TP 90 -co, --compile-only 91 .br 92 Compiles the script without running it\&. 93 .TP 94 -cp \fIpath\fR , -classpath \fIpath\fR 95 .br 96 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 (:)\&. 97 .TP 98 -D\fIname\fR=\fIvalue\fR 99 .br 100 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\fR to the property named \f3myKey\fR: 101 .sp 102 .nf 103 \f3>> \fIjjs \-DmyKey=myValue\fR\fP 104 .fi 105 .nf 106 \f3jjs> \fIjava\&.lang\&.System\&.getProperty("myKey")\fR\fP 107 .fi 108 .nf 109 \f3myValue\fP 110 .fi 111 .nf 112 \f3jjs>\fP 113 .fi 114 .nf 115 \f3\fP 116 .fi 117 .sp 118 119 120 This option can be repeated to set multiple properties\&. 121 .TP 122 -d=\fIpath\fR , --dump-debug-dir=\fIpath\fR 123 .br 124 Specifies the path to the directory where class files are dumped\&. 125 .TP 126 --debug-lines 127 .br 128 Generates a line number table in the class file\&. By default, this option is enabled\&. To disable it, specify \f3--debug-lines=false\fR\&. 129 .TP 130 --debug-locals 131 .br 132 Generates a local variable table in the class file\&. 133 .TP 134 -doe, --dump-on-error 135 .br 136 Provides a full stack trace when an error occurs\&. By default, only a brief error message is printed\&. 137 .TP 138 --early-lvalue-error 139 .br 140 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\fR\&. When disabled, invalid lvalue expressions will not be reported until the code is executed\&. 141 .TP 142 --empty-statements 143 .br 144 Preserves empty statements in the Java abstract syntax tree\&. 145 .TP 146 -fv, --fullversion 147 .br 148 Prints the full Nashorn version string\&. 149 .TP 150 --function-statement-error 151 .br 152 Prints an error message when a function declaration is used as a statement\&. 153 .TP 154 --function-statement-warning 155 .br 156 Prints a warning message when a function declaration is used as a statement\&. 157 .TP 158 -fx 159 .br 160 Launches the script as a JavaFX application\&. 161 .TP 162 -h, -help 163 .br 164 Prints the list of options and their descriptions\&. 165 .TP 166 -J\fIoption\fR 167 .br 168 Passes the specified \f3java\fR 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: 169 .sp 170 .nf 171 \f3>> \fIjjs \-J\-Xmx4g\fR\fP 172 .fi 173 .nf 174 \f3jjs> \fIjava\&.lang\&.Runtime\&.getRuntime()\&.maxMemory()\fR\fP 175 .fi 176 .nf 177 \f33817799680\fP 178 .fi 179 .nf 180 \f3jjs>\fP 181 .fi 182 .nf 183 \f3\fP 184 .fi 185 .sp 186 187 188 This option can be repeated to pass multiple \f3java\fR command options\&. 189 .TP 190 --language=[es5] 191 .br 192 Specifies the ECMAScript language version\&. The default version is ES5\&. 193 .TP 194 --lazy-compilation 195 .br 196 Enables lazy code generation strategies (that is, the entire script is not compiled at once)\&. This option is experimental\&. 197 .TP 198 --loader-per-compile 199 .br 200 Creates a new class loader per compile\&. By default, this option is enabled\&. To disable it, specify \f3--loader-per-compile=false\fR\&. 201 .TP 202 --log=\fIsubsystem\fR:\fIlevel\fR 203 .br 204 Performs logging at a given level for the specified subsystems\&. You can specify logging levels for multiple subsystems separating them with commas\&. For example: 205 .sp 206 .nf 207 \f3\-\-log=fields:finest,codegen:info\fP 208 .fi 209 .sp 210 211 .TP 212 --optimistic-types=[true|false] 213 .br 214 Enables or disables optimistic type assumptions with deoptimizing recompilation\&. Running with optimistic types will yield higher final speed, but may increase warmup time\&. 215 .TP 216 --package=\fIname\fR 217 .br 218 Specifies the package to which generated class files are added\&. 219 .TP 220 --parse-only 221 .br 222 Parses the code without compiling\&. 223 .TP 224 --print-ast 225 .br 226 Prints the abstract syntax tree\&. 227 .TP 228 --print-code 229 .br 230 Prints bytecode\&. 231 .TP 232 --print-lower-ast 233 .br 234 Prints the lowered abstract syntax tree\&. 235 .TP 236 --print-lower-parse 237 .br 238 Prints the lowered parse tree\&. 239 .TP 240 --print-no-newline 241 .br 242 Forces other \f3--print*\fR options to print the output on one line\&. 243 .TP 244 --print-parse 245 .br 246 Prints the parse tree\&. 247 .TP 248 --print-symbols 249 .br 250 Prints the symbol table\&. 251 .TP 252 -pcs, --profile-callsites 253 .br 254 Dumps callsite profile data\&. 255 .TP 256 -scripting 257 .br 258 Enables shell scripting features\&. 259 .TP 260 --stderr=\fIfilename\fR|\fIstream\fR|\fItty\fR 261 .br 262 Redirects the standard error stream to the specified file, stream (for example, to \f3stdout\fR), or text terminal\&. 263 .TP 264 --stdout=\fIfilename\fR|\fIstream\fR|\fItty\fR 265 .br 266 Redirects the standard output stream to the specified file, stream (for example, to \f3stderr\fR), or text terminal\&. 267 .TP 268 -strict 269 .br 270 Enables strict mode, which enforces stronger adherence to the standard (ECMAScript Edition 5\&.1), making it easier to detect common coding errors\&. 271 .TP 272 -t=\fIzone\fR , -timezone=\fIzone\fR 273 .br 274 Sets the specified time zone for script execution\&. It overrides the time zone set in the OS and used by the \f3Date\fR object\&. 275 .TP 276 -tcs=\fIparameter\fR , --trace-callsites=\fIparameter\fR 277 .br 278 Enables callsite trace mode\&. Possible parameters are the following: 279 .RS 280 .TP 281 miss 282 Trace callsite misses\&. 283 .TP 284 enterexit 285 Trace callsite enter/exit\&. 286 .TP 287 objects 288 Print object properties\&. 289 .RE 290 291 .TP 292 --verify-code 293 .br 294 Verifies bytecode before running\&. 295 .TP 296 -v, -version 297 .br 298 Prints the Nashorn version string\&. 299 .TP 300 -xhelp 301 .br 302 Prints extended help for command-line options\&. 303 .SH EXAMPLES 304 \f3Example 1 Running a Script with Nashorn\fR 305 .sp 306 .nf 307 \f3jjs script\&.js\fP 308 .fi 309 .nf 310 \f3\fP 311 .fi 312 .sp 313 \f3Example 2 Running Nashorn in Interactive Mode\fR 314 .sp 315 .nf 316 \f3>> \fIjjs\fR\fP 317 .fi 318 .nf 319 \f3jjs> \fIprintln("Hello, World!")\fR\fP 320 .fi 321 .nf 322 \f3Hello, World!\fP 323 .fi 324 .nf 325 \f3jjs> \fIquit()\fR\fP 326 .fi 327 .nf 328 \f3>>\fP 329 .fi 330 .nf 331 \f3\fP 332 .fi 333 .sp 334 \f3Example 3 Passing Arguments to Nashorn\fR 335 .sp 336 .nf 337 \f3>> \fIjjs \-\- a b c\fR\fP 338 .fi 339 .nf 340 \f3jjs> \fIarguments\&.join(", ")\fR\fP 341 .fi 342 .nf 343 \f3a, b, c\fP 344 .fi 345 .nf 346 \f3jjs>\fP 347 .fi 348 .nf 349 \f3\fP 350 .fi 351 .sp 352 .SH SEE\ ALSO 353 \f3jrunscript\fR 354 .RE 355 .br 356 'pl 8.5i 357 'bp