Java Reference
In-Depth Information
Table 10-1.
(
continued
)
Option
Description
-strict
Enables strict mode where the scripts are executed
using the ECMAScript Edition 5.1 standards.
The default is
false
.
-t=<timezone>
-timezone=<timezone>
Sets the time zone for the script execution.
The default time zone is Chicago/America.
-tcs=<option>
--trace-callsites=<option>
Enables the callsite trace mode. Valid options are
miss
(traces callsite misses),
enterexit
(traces
callsite enter/exit), and
objects
(prints object
properties). Specify multiple options by separating
them with commas:
-tcs=miss,enterexit,objects
--verify-code
Verifies the bytecode before running. The default is
false
.
-v
-version
Prints the version of the Nashorn engine.
The default is
false
.
-xhelp
Prints extended help. The default is
false
.
Using jjs in Interactive Mode
If you run
jjs
without specifying any options or script files, it is run in interactive mode.
The script is interpreted as you enter it. Recall that strings in Nashorn can be enclosed in
single quotes or double quotes.
The following are some examples of using the
jjs
tool in interactive mode. It is assumed
that you have included the path to the
jjs
tool in the PATH environment variable on your
machine. If you have not done so, you can replace
jjs
with
JDK_HOME\bin\jjs
in the
following command. Remember to execute the
quit()
or
exit()
function to exit the
jjs
tool:
c:\>jjs
jjs> "Hello Nashorn"
Hello Nashorn
jjs> "Hello".toLowerCase();
hello
jjs> var list = [1, 2, 3, 4, 5]
jjs> var sum = 0;
jjs> for each (x in list) { sum = sum + x};
15
jjs> quit()
c:\>
Search WWH ::
Custom Search