author | weijun |
Thu, 24 Oct 2019 15:53:20 +0800 | |
changeset 58776 | ea153023d832 |
parent 55140 | d4890c3721be |
permissions | -rw-r--r-- |
55140 | 1 |
.\" Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved. |
31876
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
2 |
.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
3 |
.\" |
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
4 |
.\" This code is free software; you can redistribute it and/or modify it |
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
5 |
.\" under the terms of the GNU General Public License version 2 only, as |
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
6 |
.\" published by the Free Software Foundation. |
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
7 |
.\" |
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
8 |
.\" This code is distributed in the hope that it will be useful, but WITHOUT |
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
9 |
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
10 |
.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
11 |
.\" version 2 for more details (a copy is included in the LICENSE file that |
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
12 |
.\" accompanied this code). |
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
13 |
.\" |
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
14 |
.\" You should have received a copy of the GNU General Public License version |
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
15 |
.\" 2 along with this work; if not, write to the Free Software Foundation, |
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
16 |
.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
17 |
.\" |
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
18 |
.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
19 |
.\" or visit www.oracle.com if you need additional information or have any |
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
20 |
.\" questions. |
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
21 |
.\" |
55140 | 22 |
.\" Automatically generated by Pandoc 2.3.1 |
21743 | 23 |
.\" |
55140 | 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 |
|
31876
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
42 |
.RE |
55140 | 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 |
|
31876
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
49 |
.RE |
55140 | 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 |
|
31876
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
56 |
.RE |
55140 | 57 |
.SH DESCRIPTION |
31876
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
58 |
.PP |
55140 | 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 |
|
31876
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
64 |
.PP |
55140 | 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 |
|
31876
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
83 |
.PP |
55140 | 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 |
|
31876
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
129 |
.nf |
55140 | 130 |
\f[CB] |
131 |
jjs\ \-fx\ \-\-module\-path\ /SOMEDIR/javafx\-sdk\-11/lib\ \-\-add\-modules\ javafx.controls\ HelloWorld.js |
|
132 |
\f[R] |
|
31876
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
133 |
.fi |
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
134 |
.PP |
55140 | 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 |
|
31876
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
147 |
.PP |
55140 | 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 |
|
31876
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
151 |
.nf |
55140 | 152 |
\f[CB] |
153 |
jjs\ \-fx\ HelloWorld.js |
|
154 |
||
155 |
JavaFX\ is\ not\ available. |
|
156 |
\f[R] |
|
31876
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
157 |
.fi |
55140 | 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 |
|
31876
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
163 |
.RE |
55140 | 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 |
|
31876
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
174 |
.RE |
55140 | 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 |
|
31876
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
222 |
.nf |
55140 | 223 |
\f[CB] |
224 |
jjs\ script.js |
|
225 |
\f[R] |
|
31876
91b22707521a
8131105: Header Template for nroff man pages *.1 files contains errors
mfang
parents:
21743
diff
changeset
|
226 |
.fi |
55140 | 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 |