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