jdk/src/bsd/doc/man/jjs.1
changeset 21743 3d979da7bdf0
child 31876 91b22707521a
equal deleted inserted replaced
21741:8cd632761233 21743:3d979da7bdf0
       
     1 '\" t
       
     2 .\"  Copyright (c) 1994, 2013, 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: 21 November 2013
       
    27 .\"     SectDesc: Basic Tools
       
    28 .\"     Title: jjs.1
       
    29 .\"
       
    30 .if n .pl 99999
       
    31 .TH jjs 1 "21 November 2013" "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\fR
       
    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\fR
       
   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 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\&.
       
   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\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\&.
       
   254 .TP
       
   255 --stderr=\fIfilename\fR|\fIstream\fR|\fItty\fR
       
   256 .br
       
   257 Redirects the standard error stream to the specified file, stream (for example, to \f3stdout\fR), or text terminal\&.
       
   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\&.
       
   266 .TP
       
   267 -t=\fIzone\fR , -timezone=\fIzone\fR
       
   268 .br
       
   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\&.
       
   270 .TP
       
   271 -tcs=\fIparameter\fR , --trace-callsites=\fIparameter\fR
       
   272 .br
       
   273 Enables callsite trace mode\&. Possible parameters are the following:
       
   274 .RS     
       
   275 .TP     
       
   276 miss
       
   277 Trace callsite misses\&.
       
   278 .TP     
       
   279 enterexit
       
   280 Trace callsite enter/exit\&.
       
   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\&.
       
   294 .TP
       
   295 -xhelp
       
   296 .br
       
   297 Prints extended help for command-line options\&.
       
   298 .SH EXAMPLES    
       
   299 \f3Example 1 Running a Script with Nashorn\fR
       
   300 .sp     
       
   301 .nf     
       
   302 \f3jjs script\&.js\fP
       
   303 .fi     
       
   304 .nf     
       
   305 \f3\fR
       
   306 .fi     
       
   307 .sp     
       
   308 \f3Example 2 Running Nashorn in Interactive Mode\fR
       
   309 .sp     
       
   310 .nf     
       
   311 \f3>> \fIjjs\fR\fP
       
   312 .fi     
       
   313 .nf     
       
   314 \f3jjs> \fIprintln("Hello, World!")\fR\fP
       
   315 .fi     
       
   316 .nf     
       
   317 \f3Hello, World!\fP
       
   318 .fi     
       
   319 .nf     
       
   320 \f3jjs> \fIquit()\fR\fP
       
   321 .fi     
       
   322 .nf     
       
   323 \f3>>\fP
       
   324 .fi     
       
   325 .nf     
       
   326 \f3\fR
       
   327 .fi     
       
   328 .sp     
       
   329 \f3Example 3 Passing Arguments to Nashorn\fR
       
   330 .sp     
       
   331 .nf     
       
   332 \f3>> \fIjjs \-\- a b c\fR\fP
       
   333 .fi     
       
   334 .nf     
       
   335 \f3jjs> \fIarguments\&.join(", ")\fR\fP
       
   336 .fi     
       
   337 .nf     
       
   338 \f3a, b, c\fP
       
   339 .fi     
       
   340 .nf     
       
   341 \f3jjs>\fP
       
   342 .fi     
       
   343 .nf     
       
   344 \f3\fR
       
   345 .fi     
       
   346 .sp     
       
   347 .SH SEE\ ALSO    
       
   348 \f3jrunscript\fR
       
   349 .RE
       
   350 .br
       
   351 'pl 8.5i
       
   352 'bp