1jjs(1) Basic Tools jjs(1)
2
3
4
6 jjs - Invokes the Nashorn engine.
7
9 jjs [options] [script-files] [-- arguments]
10
11 options
12 One or more options of the jjs command, separated by spaces. For
13 more information, see Options.
14
15 script-files
16 One or more script files which you want to interpret using Nashorn,
17 separated by spaces. If no files are specified, an interactive
18 shell is started.
19
20 arguments
21 All values after the double hyphen marker (--) are passed through
22 to the script or the interactive shell as arguments. These values
23 can be accessed by using the arguments property (see Example 3).
24
26 The jjs command-line tool is used to invoke the Nashorn engine. You can
27 use it to interpret one or several script files, or to run an
28 interactive shell.
29
31 The options of the jjs command control the conditions under which
32 scripts are interpreted by Nashorn.
33
34 -cp path
35 -classpath path
36 Specifies the path to the supporting class files To set multiple
37 paths, the option can be repeated, or you can separate each path
38 with a colon (:).
39
40 -Dname=value
41 Sets a system property to be passed to the script by assigning a
42 value to a property name. The following example shows how to invoke
43 Nashorn in interactive mode and assign myValue to the property
44 named myKey:
45
46 >> jjs -DmyKey=myValue
47 jjs> java.lang.System.getProperty("myKey")
48 myValue
49 jjs>
50
51 This option can be repeated to set multiple properties.
52
53 -doe
54 --dump-on-error
55 Provides a full stack trace when an error occurs. By default, only
56 a brief error message is printed.
57
58 -fv
59 --fullversion
60 Prints the full Nashorn version string.
61
62 -fx
63 Launches the script as a JavaFX application.
64
65 -h
66 -help
67 Prints the list of options and their descriptions.
68
69 --language=[es5]
70 Specifies the ECMAScript language version. The default version is
71 ES5.
72
73 -ot
74 --optimistic-types=[true|false]
75 Enables or disables optimistic type assumptions with deoptimizing
76 recompilation. Running with optimistic types will yield higher
77 final speed, but may increase warmup time.
78
79 -scripting
80 Enables shell scripting features.
81
82 -strict
83 Enables strict mode, which enforces stronger adherence to the
84 standard (ECMAScript Edition 5.1), making it easier to detect
85 common coding errors.
86
87 -t=zone
88 -timezone=zone
89 Sets the specified time zone for script execution. It overrides the
90 time zone set in the OS and used by the Date object.
91
92 -v
93 -version
94 Prints the Nashorn version string.
95
97 Example 1 Running a Script with Nashorn
98
99 jjs script.js
100
101
102 Example 2 Running Nashorn in Interactive Mode
103
104 >> jjs
105 jjs> println("Hello, World!")
106 Hello, World!
107 jjs> quit()
108 >>
109
110
111 Example 3 Passing Arguments to Nashorn
112
113 >> jjs -- a b c
114 jjs> arguments.join(", ")
115 a, b, c
116 jjs>
117
118
120 jrunscript
121
122
123
124JDK 8 03 March 2015 jjs(1)