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
.\" 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 已提交
31 32
.\"
.if n .pl 99999
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
.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 已提交
54
jjs \- Invokes the Nashorn engine\&.
55 56 57 58 59 60 61 62 63 64 65 66
.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 已提交
67
\fIoptions\fR
68 69 70 71 72 73 74 75
.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 已提交
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 78
.RE
.PP
R
rgallard 已提交
79
\fIarguments\fR
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
.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 已提交
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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
.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 已提交
123
This option can be repeated to set multiple properties\&.
124 125 126
.RE
.PP
\-doe
R
rgallard 已提交
127
.br
128 129
\-\-dump\-on\-error
.RS 4
130
Provides a full stack trace when an error occurs\&. By default, only a brief error message is printed\&.
131 132 133
.RE
.PP
\-fv
R
rgallard 已提交
134
.br
135 136
\-\-fullversion
.RS 4
R
rgallard 已提交
137
Prints the full Nashorn version string\&.
138 139 140 141
.RE
.PP
\-fx
.RS 4
R
rgallard 已提交
142
Launches the script as a JavaFX application\&.
143 144 145
.RE
.PP
\-h
R
rgallard 已提交
146
.br
147 148
\-help
.RS 4
R
rgallard 已提交
149
Prints the list of options and their descriptions\&.
150 151 152 153
.RE
.PP
\-\-language=[es5]
.RS 4
154
Specifies the ECMAScript language version\&. The default version is ES5\&.
155 156 157
.RE
.PP
\-ot
158
.br
159 160
\-\-optimistic\-types=[true|false]
.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 163 164 165
.RE
.PP
\-scripting
.RS 4
R
rgallard 已提交
166
Enables shell scripting features\&.
167 168 169 170
.RE
.PP
\-strict
.RS 4
R
rgallard 已提交
171
Enables strict mode, which enforces stronger adherence to the standard (ECMAScript Edition 5\&.1), making it easier to detect common coding errors\&.
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
.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 已提交
187
Prints the Nashorn version string\&.
188 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
.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