jjs.1 5.8 KB
Newer Older
R
rgallard 已提交
1
'\" t
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
.\" 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.
.\"
.\" This code is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
.\" version 2 for more details (a copy is included in the LICENSE file that
.\" accompanied this code).
.\"
.\" You should have received a copy of the GNU General Public License version
.\" 2 along with this work; if not, write to the Free Software Foundation,
.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
.\"
.\" 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
R
rgallard 已提交
32 33
.\"
.if n .pl 99999
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
.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"
R
rgallard 已提交
55
jjs \- Invokes the Nashorn engine\&.
56 57 58 59 60 61 62 63 64 65 66 67
.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
R
rgallard 已提交
68
\fIoptions\fR
69 70 71 72 73 74 75 76
.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
R
rgallard 已提交
77
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\&.
78 79
.RE
.PP
R
rgallard 已提交
80
\fIarguments\fR
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
.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
R
rgallard 已提交
101
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 (:)\&.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
.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
.\}
R
rgallard 已提交
124
This option can be repeated to set multiple properties\&.
125 126 127
.RE
.PP
\-doe
R
rgallard 已提交
128
.br
129 130
\-\-dump\-on\-error
.RS 4
131
Provides a full stack trace when an error occurs\&. By default, only a brief error message is printed\&.
132 133 134
.RE
.PP
\-fv
R
rgallard 已提交
135
.br
136 137
\-\-fullversion
.RS 4
R
rgallard 已提交
138
Prints the full Nashorn version string\&.
139 140 141 142
.RE
.PP
\-fx
.RS 4
R
rgallard 已提交
143
Launches the script as a JavaFX application\&.
144 145 146
.RE
.PP
\-h
R
rgallard 已提交
147
.br
148 149
\-help
.RS 4
R
rgallard 已提交
150
Prints the list of options and their descriptions\&.
151 152 153 154
.RE
.PP
\-\-language=[es5]
.RS 4
155
Specifies the ECMAScript language version\&. The default version is ES5\&.
156 157 158
.RE
.PP
\-ot
159
.br
160 161
\-\-optimistic\-types=[true|false]
.RS 4
162
Enables or disables optimistic type assumptions with deoptimizing recompilation\&. Running with optimistic types will yield higher final speed, but may increase warmup time\&.
163 164 165 166
.RE
.PP
\-scripting
.RS 4
R
rgallard 已提交
167
Enables shell scripting features\&.
168 169 170 171
.RE
.PP
\-strict
.RS 4
R
rgallard 已提交
172
Enables strict mode, which enforces stronger adherence to the standard (ECMAScript Edition 5\&.1), making it easier to detect common coding errors\&.
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
.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
R
rgallard 已提交
188
Prints the Nashorn version string\&.
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
.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