55140
|
1 |
.\"t
|
|
2 |
.\" Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
|
|
3 |
.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
.\"
|
|
5 |
.\" This code is free software; you can redistribute it and/or modify it
|
|
6 |
.\" under the terms of the GNU General Public License version 2 only, as
|
|
7 |
.\" published by the Free Software Foundation.
|
|
8 |
.\"
|
|
9 |
.\" This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 |
.\" version 2 for more details (a copy is included in the LICENSE file that
|
|
13 |
.\" accompanied this code).
|
|
14 |
.\"
|
|
15 |
.\" You should have received a copy of the GNU General Public License version
|
|
16 |
.\" 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 |
.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 |
.\"
|
|
19 |
.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
20 |
.\" or visit www.oracle.com if you need additional information or have any
|
|
21 |
.\" questions.
|
|
22 |
.\"
|
|
23 |
.\" Automatically generated by Pandoc 2.3.1
|
|
24 |
.\"
|
|
25 |
.TH "JSHELL" "1" "2018" "JDK 13" "JDK Commands"
|
|
26 |
.hy
|
|
27 |
.SH NAME
|
|
28 |
.PP
|
|
29 |
jshell \- interactively evaluate declarations, statements, and
|
|
30 |
expressions of the Java programming language in a read\-eval\-print loop
|
|
31 |
(REPL)
|
|
32 |
.SH SYNOPSIS
|
|
33 |
.PP
|
|
34 |
\f[CB]jshell\f[R] [\f[I]options\f[R]] [\f[I]load\-files\f[R]]
|
|
35 |
.TP
|
|
36 |
.B \f[I]options\f[R]
|
|
37 |
Command\-line options, separated by spaces.
|
|
38 |
See \f[B]Options for jshell\f[R].
|
|
39 |
.RS
|
|
40 |
.RE
|
|
41 |
.TP
|
|
42 |
.B \f[I]load\-files\f[R]
|
|
43 |
One or more scripts to run when the tool is started.
|
|
44 |
Scripts can contain any valid code snippets or JShell commands.
|
|
45 |
.RS
|
|
46 |
.PP
|
|
47 |
The script can be a local file or one of following predefined scripts:
|
|
48 |
.TP
|
|
49 |
.B \f[CB]DEFAULT\f[R]
|
|
50 |
Loads the default entries, which are commonly used as imports.
|
|
51 |
.RS
|
|
52 |
.RE
|
|
53 |
.TP
|
|
54 |
.B \f[CB]JAVASE\f[R]
|
|
55 |
Imports all Java SE packages.
|
|
56 |
.RS
|
|
57 |
.RE
|
|
58 |
.TP
|
|
59 |
.B \f[CB]PRINTING\f[R]
|
|
60 |
Defines \f[CB]print\f[R], \f[CB]println\f[R], and \f[CB]printf\f[R] as
|
|
61 |
\f[CB]jshell\f[R] methods for use within the tool.
|
|
62 |
.RS
|
|
63 |
.RE
|
|
64 |
.PP
|
|
65 |
For more than one script, use a space to separate the names.
|
|
66 |
Scripts are run in the order in which they\[aq]re entered on the command
|
|
67 |
line.
|
|
68 |
Command\-line scripts are run after startup scripts.
|
|
69 |
To run a script after JShell is started, use the \f[CB]/open\f[R] command.
|
|
70 |
.PP
|
|
71 |
To accept input from standard input and suppress the interactive I/O,
|
|
72 |
enter a hyphen (\-) for \f[I]load\-files\f[R].
|
|
73 |
This option enables the use of the \f[CB]jshell\f[R] tool in pipe chains.
|
|
74 |
.RE
|
|
75 |
.SH DESCRIPTION
|
|
76 |
.PP
|
|
77 |
JShell provides a way to interactively evaluate declarations,
|
|
78 |
statements, and expressions of the Java programming language, making it
|
|
79 |
easier to learn the language, explore unfamiliar code and APIs, and
|
|
80 |
prototype complex code.
|
|
81 |
Java statements, variable definitions, method definitions, class
|
|
82 |
definitions, import statements, and expressions are accepted.
|
|
83 |
The bits of code entered are called snippets.
|
|
84 |
.PP
|
|
85 |
As snippets are entered, they\[aq]re evaluated, and feedback is
|
|
86 |
provided.
|
|
87 |
Feedback varies from the results and explanations of actions to nothing,
|
|
88 |
depending on the snippet entered and the feedback mode chosen.
|
|
89 |
Errors are described regardless of the feedback mode.
|
|
90 |
Start with the verbose mode to get the most feedback while learning the
|
|
91 |
tool.
|
|
92 |
.PP
|
|
93 |
Command\-line options are available for configuring the initial
|
|
94 |
environment when JShell is started.
|
|
95 |
Within JShell, commands are available for modifying the environment as
|
|
96 |
needed.
|
|
97 |
.PP
|
|
98 |
Existing snippets can be loaded from a file to initialize a JShell
|
|
99 |
session, or at any time within a session.
|
|
100 |
Snippets can be modified within the session to try out different
|
|
101 |
variations and make corrections.
|
|
102 |
To keep snippets for later use, save them to a file.
|
|
103 |
.SH OPTIONS FOR JSHELL
|
|
104 |
.TP
|
|
105 |
.B \f[CB]\-\-add\-modules\f[R] \f[I]module\f[R][\f[CB],\f[R]\f[I]module\f[R]...]
|
|
106 |
Specifies the root modules to resolve in addition to the initial module.
|
|
107 |
.RS
|
|
108 |
.RE
|
|
109 |
.TP
|
|
110 |
.B \f[CB]\-C\f[R]\f[I]flag\f[R]
|
|
111 |
Provides a flag to pass to the compiler.
|
|
112 |
To pass more than one flag, provide an instance of this option for each
|
|
113 |
flag or flag argument needed.
|
|
114 |
.RS
|
|
115 |
.RE
|
|
116 |
.TP
|
|
117 |
.B \f[CB]\-\-class\-path\f[R] \f[I]path\f[R]
|
|
118 |
Specifies the directories and archives that are searched to locate class
|
|
119 |
files.
|
|
120 |
This option overrides the path in the \f[CB]CLASSPATH\f[R] environment
|
|
121 |
variable.
|
|
122 |
If the environment variable isn\[aq]t set and this option isn\[aq]t
|
|
123 |
used, then the current directory is searched.
|
|
124 |
For Oracle Solaris, Linux, and macOS, use a colon (:) to separate items
|
|
125 |
in the path.
|
|
126 |
For Windows, use a semicolon (;) to separate items.
|
|
127 |
.RS
|
|
128 |
.RE
|
|
129 |
.TP
|
|
130 |
.B \f[CB]\-\-feedback\f[R] \f[I]mode\f[R]
|
|
131 |
Sets the initial level of feedback provided in response to what\[aq]s
|
|
132 |
entered.
|
|
133 |
The initial level can be overridden within a session by using the
|
|
134 |
\f[CB]/set\ feedback\f[R] \f[I]mode\f[R] command.
|
|
135 |
The default is \f[CB]normal\f[R].
|
|
136 |
.RS
|
|
137 |
.PP
|
|
138 |
The following values are valid for \f[I]mode\f[R]:
|
|
139 |
.TP
|
|
140 |
.B \f[CB]verbose\f[R]
|
|
141 |
Provides detailed feedback for entries.
|
|
142 |
Additional information about the action performed is displayed after the
|
|
143 |
result of the action.
|
|
144 |
The next prompt is separated from the feedback by a blank line.
|
|
145 |
.RS
|
|
146 |
.RE
|
|
147 |
.TP
|
|
148 |
.B \f[CB]normal\f[R]
|
|
149 |
Provides an average amount of feedback.
|
|
150 |
The next prompt is separated from the feedback by a blank line.
|
|
151 |
.RS
|
|
152 |
.RE
|
|
153 |
.TP
|
|
154 |
.B \f[CB]concise\f[R]
|
|
155 |
Provides minimal feedback.
|
|
156 |
The next prompt immediately follows the code snippet or feedback.
|
|
157 |
.RS
|
|
158 |
.RE
|
|
159 |
.TP
|
|
160 |
.B \f[CB]silent\f[R]
|
|
161 |
Provides no feedback.
|
|
162 |
The next prompt immediately follows the code snippet.
|
|
163 |
.RS
|
|
164 |
.RE
|
|
165 |
.TP
|
|
166 |
.B \f[I]custom\f[R]
|
|
167 |
Provides custom feedback based on how the mode is defined.
|
|
168 |
Custom feedback modes are created within JShell by using the
|
|
169 |
\f[CB]/set\ mode\f[R] command.
|
|
170 |
.RS
|
|
171 |
.RE
|
|
172 |
.RE
|
|
173 |
.TP
|
|
174 |
.B \f[CB]\-\-help\f[R] or \f[CB]\-h\f[R] or \f[CB]\-?\f[R]
|
|
175 |
Prints a summary of standard options and exits the tool.
|
|
176 |
.RS
|
|
177 |
.RE
|
|
178 |
.TP
|
|
179 |
.B \f[CB]\-\-help\-extra\f[R] or \f[CB]\-X\f[R]
|
|
180 |
Prints a summary of nonstandard options and exits the tool.
|
|
181 |
Nonstandard options are subject to change without notice.
|
|
182 |
.RS
|
|
183 |
.RE
|
|
184 |
.TP
|
|
185 |
.B \f[CB]\-J\f[R]\f[I]flag\f[R]
|
|
186 |
Provides a flag to pass to the runtime system.
|
|
187 |
To pass more than one flag, provide an instance of this option for each
|
|
188 |
flag or flag argument needed.
|
|
189 |
.RS
|
|
190 |
.RE
|
|
191 |
.TP
|
|
192 |
.B \f[CB]\-\-module\-path\f[R] \f[I]modulepath\f[R]
|
|
193 |
Specifies where to find application modules.
|
|
194 |
For Oracle Solaris, Linux, and macOS, use a colon (:) to separate items
|
|
195 |
in the path.
|
|
196 |
For Windows, use a semicolon (;) to separate items.
|
|
197 |
.RS
|
|
198 |
.RE
|
|
199 |
.TP
|
|
200 |
.B \f[CB]\-\-no\-startup\f[R]
|
|
201 |
Prevents startup scripts from running when JShell starts.
|
|
202 |
Use this option to run only the scripts entered on the command line when
|
|
203 |
JShell is started, or to start JShell without any preloaded information
|
|
204 |
if no scripts are entered.
|
|
205 |
This option can\[aq]t be used if the \f[CB]\-\-startup\f[R] option is
|
|
206 |
used.
|
|
207 |
.RS
|
|
208 |
.RE
|
|
209 |
.TP
|
|
210 |
.B \f[CB]\-q\f[R]
|
|
211 |
Sets the feedback mode to \f[CB]concise\f[R], which is the same as
|
|
212 |
entering \f[CB]\-\-feedback\ concise\f[R].
|
|
213 |
.RS
|
|
214 |
.RE
|
|
215 |
.TP
|
|
216 |
.B \f[CB]\-R\f[R]\f[I]flag\f[R]
|
|
217 |
Provides a flag to pass to the remote runtime system.
|
|
218 |
To pass more than one flag, provide an instance of this option for each
|
|
219 |
flag or flag argument to pass.
|
|
220 |
.RS
|
|
221 |
.RE
|
|
222 |
.TP
|
|
223 |
.B \f[CB]\-s\f[R]
|
|
224 |
Sets the feedback mode to \f[CB]silent\f[R], which is the same as entering
|
|
225 |
\f[CB]\-\-feedback\ silent\f[R].
|
|
226 |
.RS
|
|
227 |
.RE
|
|
228 |
.TP
|
|
229 |
.B \f[CB]\-\-show\-version\f[R]
|
|
230 |
Prints version information and enters the tool.
|
|
231 |
.RS
|
|
232 |
.RE
|
|
233 |
.TP
|
|
234 |
.B \f[CB]\-\-startup\f[R] \f[I]file\f[R]
|
|
235 |
Overrides the default startup script for this session.
|
|
236 |
The script can contain any valid code snippets or commands.
|
|
237 |
.RS
|
|
238 |
.PP
|
|
239 |
The script can be a local file or one of the following predefined
|
|
240 |
scripts:
|
|
241 |
.TP
|
|
242 |
.B \f[CB]DEFAULT\f[R]
|
|
243 |
Loads the default entries, which are commonly used as imports.
|
|
244 |
.RS
|
|
245 |
.RE
|
|
246 |
.TP
|
|
247 |
.B \f[CB]JAVASE\f[R]
|
|
248 |
Imports all Java SE packages.
|
|
249 |
.RS
|
|
250 |
.RE
|
|
251 |
.TP
|
|
252 |
.B \f[CB]PRINTING\f[R]
|
|
253 |
Defines \f[CB]print\f[R], \f[CB]println\f[R], and \f[CB]printf\f[R] as
|
|
254 |
\f[CB]jshell\f[R] methods for use within the tool.
|
|
255 |
.RS
|
|
256 |
.RE
|
|
257 |
.PP
|
|
258 |
For more than one script, provide a separate instance of this option for
|
|
259 |
each script.
|
|
260 |
Startup scripts are run when JShell is first started and when the
|
|
261 |
session is restarted with the \f[CB]/reset\f[R], \f[CB]/reload\f[R], or
|
|
262 |
\f[CB]/env\f[R] command.
|
|
263 |
Startup scripts are run in the order in which they\[aq]re entered on the
|
|
264 |
command line.
|
|
265 |
.PP
|
|
266 |
This option can\[aq]t be used if the \f[CB]\-\-no\-startup\f[R] option is
|
|
267 |
used.
|
|
268 |
.RE
|
|
269 |
.TP
|
|
270 |
.B \f[CB]\-v\f[R]
|
|
271 |
Sets the feedback mode to \f[CB]verbose\f[R], which is the same as
|
|
272 |
entering \f[CB]\-\-feedback\ verbose\f[R].
|
|
273 |
.RS
|
|
274 |
.RE
|
|
275 |
.TP
|
|
276 |
.B \f[CB]\-\-version\f[R]
|
|
277 |
Prints version information and exits the tool.
|
|
278 |
.RS
|
|
279 |
.RE
|
|
280 |
.SH JSHELL COMMANDS
|
|
281 |
.PP
|
|
282 |
Within the \f[CB]jshell\f[R] tool, commands are used to modify the
|
|
283 |
environment and manage code snippets.
|
|
284 |
.TP
|
|
285 |
.B \f[CB]/drop\f[R] {\f[I]name\f[R]|\f[I]id\f[R]|\f[I]startID\f[R]\f[CB]\-\f[R]\f[I]endID\f[R]} [{\f[I]name\f[R]|\f[I]id\f[R]|\f[I]startID\f[R]\f[CB]\-\f[R]\f[I]endID\f[R]}...]
|
|
286 |
Drops snippets identified by name, ID, or ID range, making them
|
|
287 |
inactive.
|
|
288 |
For a range of IDs, provide the starting ID and ending ID separated with
|
|
289 |
a hyphen.
|
|
290 |
To provide a list, separate the items in the list with a space.
|
|
291 |
Use the \f[CB]/list\f[R] command to see the IDs of code snippets.
|
|
292 |
.RS
|
|
293 |
.RE
|
|
294 |
.TP
|
|
295 |
.B \f[CB]/edit\f[R] [\f[I]option\f[R]]
|
|
296 |
Opens an editor.
|
|
297 |
If no option is entered, then the editor opens with the active snippets.
|
|
298 |
.RS
|
|
299 |
.PP
|
|
300 |
The following options are valid:
|
|
301 |
.TP
|
|
302 |
.B {\f[I]name\f[R]|\f[I]id\f[R]|\f[I]startID\f[R]\f[CB]\-\f[R]\f[I]endID\f[R]} [{\f[I]name\f[R]|\f[I]id\f[R]|\f[I]startID\f[R]\f[CB]\-\f[R]\f[I]endID\f[R]}...]
|
|
303 |
Opens the editor with the snippets identified by name, ID, or ID range.
|
|
304 |
For a range of IDs, provide the starting ID and ending ID separated with
|
|
305 |
a hyphen.
|
|
306 |
To provide a list, separate the items in the list with a space.
|
|
307 |
Use the \f[CB]/list\f[R] command to see the IDs of code snippets.
|
|
308 |
.RS
|
|
309 |
.RE
|
|
310 |
.TP
|
|
311 |
.B \f[CB]\-all\f[R]
|
|
312 |
Opens the editor with all snippets, including startup snippets and
|
|
313 |
snippets that failed, were overwritten, or were dropped.
|
|
314 |
.RS
|
|
315 |
.RE
|
|
316 |
.TP
|
|
317 |
.B \f[CB]\-start\f[R]
|
|
318 |
Opens the editor with startup snippets that were evaluated when JShell
|
|
319 |
was started.
|
|
320 |
.RS
|
|
321 |
.RE
|
|
322 |
.PP
|
|
323 |
To exit edit mode, close the editor window, or respond to the prompt
|
|
324 |
provided if the \f[CB]\-wait\f[R] option was used when the editor was set.
|
|
325 |
.PP
|
|
326 |
Use the \f[CB]/set\ editor\f[R] command to specify the editor to use.
|
|
327 |
If no editor is set, then the following environment variables are
|
|
328 |
checked in order: \f[CB]JSHELLEDITOR\f[R], \f[CB]VISUAL\f[R], and
|
|
329 |
\f[CB]EDITOR\f[R].
|
|
330 |
If no editor is set in JShell and none of the editor environment
|
|
331 |
variables is set, then a simple default editor is used.
|
|
332 |
.RE
|
|
333 |
.TP
|
|
334 |
.B \f[CB]/env\f[R] [\f[I]options\f[R]]
|
|
335 |
Displays the environment settings, or updates the environment settings
|
|
336 |
and restarts the session.
|
|
337 |
If no option is entered, then the current environment settings are
|
|
338 |
displayed.
|
|
339 |
If one or more options are entered, then the session is restarted as
|
|
340 |
follows:
|
|
341 |
.RS
|
|
342 |
.IP \[bu] 2
|
|
343 |
Updates the environment settings with the provided options.
|
|
344 |
.IP \[bu] 2
|
|
345 |
Resets the execution state.
|
|
346 |
.IP \[bu] 2
|
|
347 |
Runs the startup scripts.
|
|
348 |
.IP \[bu] 2
|
|
349 |
Silently replays the history in the order entered.
|
|
350 |
The history includes all valid snippets or \f[CB]/drop\f[R] commands
|
|
351 |
entered at the \f[CB]jshell\f[R] prompt, in scripts entered on the command
|
|
352 |
line, or scripts entered with the \f[CB]/open\f[R] command.
|
|
353 |
.PP
|
|
354 |
Environment settings entered on the command line or provided with a
|
|
355 |
previous \f[CB]/reset\f[R], \f[CB]/env\f[R], or \f[CB]/reload\f[R] command are
|
|
356 |
maintained unless an \f[I]option\f[R] is entered that overwrites the
|
|
357 |
setting.
|
|
358 |
.PP
|
|
359 |
The following options are valid:
|
|
360 |
.TP
|
|
361 |
.B \f[CB]\-\-add\-modules\f[R] \f[I]module\f[R][\f[CB],\f[R]\f[I]module\f[R]...]
|
|
362 |
Specifies the root modules to resolve in addition to the initial module.
|
|
363 |
.RS
|
|
364 |
.RE
|
|
365 |
.TP
|
|
366 |
.B \f[CB]\-\-add\-exports\f[R] \f[I]source\-module\f[R]\f[CB]/\f[R]\f[I]package\f[R]\f[CB]=\f[R]\f[I]target\-module\f[R][\f[CB],\f[R]\f[I]target\-module\f[R]]*
|
|
367 |
Adds an export of \f[I]package\f[R] from \f[I]source\-module\f[R] to
|
|
368 |
\f[I]target\-module\f[R].
|
|
369 |
.RS
|
|
370 |
.RE
|
|
371 |
.TP
|
|
372 |
.B \f[CB]\-\-class\-path\f[R] \f[I]path\f[R]
|
|
373 |
Specifies the directories and archives that are searched to locate class
|
|
374 |
files.
|
|
375 |
This option overrides the path in the \f[CB]CLASSPATH\f[R] environment
|
|
376 |
variable.
|
|
377 |
If the environment variable isn\[aq]t set and this option isn\[aq]t
|
|
378 |
used, then the current directory is searched.
|
|
379 |
For Oracle Solaris, Linux, and macOS, use a colon (\f[CB]:\f[R]) to
|
|
380 |
separate items in the path.
|
|
381 |
For Windows, use a semicolon (\f[CB];\f[R]) to separate items.
|
|
382 |
.RS
|
|
383 |
.RE
|
|
384 |
.TP
|
|
385 |
.B \f[CB]\-\-module\-path\f[R] \f[I]modulepath\f[R]
|
|
386 |
Specifies where to find application modules.
|
|
387 |
For Oracle Solaris, Linux, and macOS, use a colon (\f[CB]:\f[R]) to
|
|
388 |
separate items in the path.
|
|
389 |
For Windows, use a semicolon (\f[CB];\f[R]) to separate items.
|
|
390 |
.RS
|
|
391 |
.RE
|
|
392 |
.RE
|
|
393 |
.TP
|
|
394 |
.B \f[CB]/exit\f[R] [\f[I]integer\-expression\-snippet\f[R]]
|
|
395 |
Exits the tool.
|
|
396 |
If no snippet is entered, the exit status is zero.
|
|
397 |
If a snippet is entered and the result of the snippet is an integer, the
|
|
398 |
result is used as the exit status.
|
|
399 |
If an error occurs, or the result of the snippet is not an integer, an
|
|
400 |
error is displayed and the tool remains active.
|
|
401 |
.RS
|
|
402 |
.RE
|
|
403 |
.TP
|
|
404 |
.B \f[CB]/history\f[R]
|
|
405 |
Displays what was entered in this session.
|
|
406 |
.RS
|
|
407 |
.RE
|
|
408 |
.TP
|
|
409 |
.B \f[CB]/help\f[R] [\f[I]command\f[R]|\f[I]subject\f[R]]
|
|
410 |
Displays information about commands and subjects.
|
|
411 |
If no options are entered, then a summary of information for all
|
|
412 |
commands and a list of available subjects are displayed.
|
|
413 |
If a valid command is provided, then expanded information for that
|
|
414 |
command is displayed.
|
|
415 |
If a valid subject is entered, then information about that subject is
|
|
416 |
displayed.
|
|
417 |
.RS
|
|
418 |
.PP
|
|
419 |
The following values for \f[I]subject\f[R] are valid:
|
|
420 |
.TP
|
|
421 |
.B \f[CB]context\f[R]
|
|
422 |
Describes the options that are available for configuring the
|
|
423 |
environment.
|
|
424 |
.RS
|
|
425 |
.RE
|
|
426 |
.TP
|
|
427 |
.B \f[CB]intro\f[R]
|
|
428 |
Provides an introduction to the tool.
|
|
429 |
.RS
|
|
430 |
.RE
|
|
431 |
.TP
|
|
432 |
.B \f[CB]shortcuts\f[R]
|
|
433 |
Describes keystrokes for completing commands and snippets.
|
|
434 |
See \f[B]Input Shortcuts\f[R].
|
|
435 |
.RS
|
|
436 |
.RE
|
|
437 |
.RE
|
|
438 |
.TP
|
|
439 |
.B \f[CB]/imports\f[R]
|
|
440 |
Displays the current active imports, including those from the startup
|
|
441 |
scripts and scripts that were entered on the command line when JShell
|
|
442 |
was started.
|
|
443 |
.RS
|
|
444 |
.RE
|
|
445 |
.TP
|
|
446 |
.B \f[CB]/list\f[R] [\f[I]option\f[R]]
|
|
447 |
Displays a list of snippets and their IDs.
|
|
448 |
If no option is entered, then all active snippets are displayed, but
|
|
449 |
startup snippets aren\[aq]t.
|
|
450 |
.RS
|
|
451 |
.PP
|
|
452 |
The following options are valid:
|
|
453 |
.TP
|
|
454 |
.B {\f[I]name\f[R]|\f[I]id\f[R]|\f[I]startID\f[R]\f[CB]\-\f[R]\f[I]endID\f[R]} [{\f[I]name\f[R]|\f[I]id\f[R]|\f[I]startID\f[R]\f[CB]\-\f[R]\f[I]endID\f[R]}...]
|
|
455 |
Displays the snippets identified by name, ID, or ID range.
|
|
456 |
For a range of IDs, provide the starting ID and ending ID separated with
|
|
457 |
a hyphen.
|
|
458 |
To provide a list, separate the items in the list with a space.
|
|
459 |
.RS
|
|
460 |
.RE
|
|
461 |
.TP
|
|
462 |
.B \f[CB]\-all\f[R]
|
|
463 |
Displays all snippets, including startup snippets and snippets that
|
|
464 |
failed, were overwritten, or were dropped.
|
|
465 |
IDs that begin with \f[CB]s\f[R] are startup snippets.
|
|
466 |
IDs that begin with \f[CB]e\f[R] are snippets that failed.
|
|
467 |
.RS
|
|
468 |
.RE
|
|
469 |
.TP
|
|
470 |
.B \f[CB]\-start\f[R]
|
|
471 |
Displays startup snippets that were evaluated when JShell was started.
|
|
472 |
.RS
|
|
473 |
.RE
|
|
474 |
.RE
|
|
475 |
.TP
|
|
476 |
.B \f[CB]/methods\f[R] [\f[I]option\f[R]]
|
|
477 |
Displays information about the methods that were entered.
|
|
478 |
If no option is entered, then the name, parameter types, and return type
|
|
479 |
of all active methods are displayed.
|
|
480 |
.RS
|
|
481 |
.PP
|
|
482 |
The following options are valid:
|
|
483 |
.TP
|
|
484 |
.B {\f[I]name\f[R]|\f[I]id\f[R]|\f[I]startID\f[R]\f[CB]\-\f[R]\f[I]endID\f[R]} [{\f[I]name\f[R]|\f[I]id\f[R]|\f[I]startID\f[R]\f[CB]\-\f[R]\f[I]endID\f[R]}...]
|
|
485 |
Displays information for methods identified by name, ID, or ID range.
|
|
486 |
For a range of IDs, provide the starting ID and ending ID separated with
|
|
487 |
a hyphen.
|
|
488 |
To provide a list, separate the items in the list with a space.
|
|
489 |
Use the \f[CB]/list\f[R] command to see the IDs of code snippets.
|
|
490 |
.RS
|
|
491 |
.RE
|
|
492 |
.TP
|
|
493 |
.B \f[CB]\-all\f[R]
|
|
494 |
Displays information for all methods, including those added when JShell
|
|
495 |
was started, and methods that failed, were overwritten, or were dropped.
|
|
496 |
.RS
|
|
497 |
.RE
|
|
498 |
.TP
|
|
499 |
.B \f[CB]\-start\f[R]
|
|
500 |
Displays information for startup methods that were added when JShell was
|
|
501 |
started.
|
|
502 |
.RS
|
|
503 |
.RE
|
|
504 |
.RE
|
|
505 |
.TP
|
|
506 |
.B \f[CB]/open\f[R] \f[I]file\f[R]
|
|
507 |
Opens the script specified and reads the snippets into the tool.
|
|
508 |
The script can be a local file or one of the following predefined
|
|
509 |
scripts:
|
|
510 |
.RS
|
|
511 |
.TP
|
|
512 |
.B \f[CB]DEFAULT\f[R]
|
|
513 |
Loads the default entries, which are commonly used as imports.
|
|
514 |
.RS
|
|
515 |
.RE
|
|
516 |
.TP
|
|
517 |
.B \f[CB]JAVASE\f[R]
|
|
518 |
Imports all Java SE packages.
|
|
519 |
.RS
|
|
520 |
.RE
|
|
521 |
.TP
|
|
522 |
.B \f[CB]PRINTING\f[R]
|
|
523 |
Defines \f[CB]print\f[R], \f[CB]println\f[R], and \f[CB]printf\f[R] as
|
|
524 |
\f[CB]jshell\f[R] methods for use within the tool.
|
|
525 |
.RS
|
|
526 |
.RE
|
|
527 |
.RE
|
|
528 |
.TP
|
|
529 |
.B \f[CB]/reload\f[R] [\f[I]options\f[R]]
|
|
530 |
Restarts the session as follows:
|
|
531 |
.RS
|
|
532 |
.IP \[bu] 2
|
|
533 |
Updates the environment settings with the provided options, if any.
|
|
534 |
.IP \[bu] 2
|
|
535 |
Resets the execution state.
|
|
536 |
.IP \[bu] 2
|
|
537 |
Runs the startup scripts.
|
|
538 |
.IP \[bu] 2
|
|
539 |
Replays the history in the order entered.
|
|
540 |
The history includes all valid snippets or \f[CB]/drop\f[R] commands
|
|
541 |
entered at the \f[CB]jshell\f[R] prompt, in scripts entered on the command
|
|
542 |
line, or scripts entered with the \f[CB]/open\f[R] command.
|
|
543 |
.PP
|
|
544 |
Environment settings entered on the command line or provided with a
|
|
545 |
previous \f[CB]/reset\f[R], \f[CB]/env\f[R], or \f[CB]/reload\f[R] command are
|
|
546 |
maintained unless an \f[I]option\f[R] is entered that overwrites the
|
|
547 |
setting.
|
|
548 |
.PP
|
|
549 |
The following options are valid:
|
|
550 |
.TP
|
|
551 |
.B \f[CB]\-\-add\-modules\f[R] \f[I]module\f[R][\f[CB],\f[R]\f[I]module\f[R]...]
|
|
552 |
Specifies the root modules to resolve in addition to the initial module.
|
|
553 |
.RS
|
|
554 |
.RE
|
|
555 |
.TP
|
|
556 |
.B \f[CB]\-\-add\-exports\f[R] \f[I]source\-module\f[R]\f[CB]/\f[R]\f[I]package\f[R]\f[CB]=\f[R]\f[I]target\-module\f[R][\f[CB],\f[R]\f[I]target\-module\f[R]]*
|
|
557 |
Adds an export of \f[I]package\f[R] from \f[I]source\-module\f[R] to
|
|
558 |
\f[I]target\-module\f[R].
|
|
559 |
.RS
|
|
560 |
.RE
|
|
561 |
.TP
|
|
562 |
.B \f[CB]\-\-class\-path\f[R] \f[I]path\f[R]
|
|
563 |
Specifies the directories and archives that are searched to locate class
|
|
564 |
files.
|
|
565 |
This option overrides the path in the \f[CB]CLASSPATH\f[R] environment
|
|
566 |
variable.
|
|
567 |
If the environment variable isn\[aq]t set and this option isn\[aq]t
|
|
568 |
used, then the current directory is searched.
|
|
569 |
For Oracle Solaris, Linux, and macOS, use a colon (\f[CB]:\f[R]) to
|
|
570 |
separate items in the path.
|
|
571 |
For Windows, use a semicolon (\f[CB];\f[R]) to separate items.
|
|
572 |
.RS
|
|
573 |
.RE
|
|
574 |
.TP
|
|
575 |
.B \f[CB]\-\-module\-path\f[R] \f[I]modulepath\f[R]
|
|
576 |
Specifies where to find application modules.
|
|
577 |
For Oracle Solaris, Linux, and macOS, use a colon (\f[CB]:\f[R]) to
|
|
578 |
separate items in the path.
|
|
579 |
For Windows, use a semicolon (\f[CB];\f[R]) to separate items.
|
|
580 |
.RS
|
|
581 |
.RE
|
|
582 |
.TP
|
|
583 |
.B \f[CB]\-quiet\f[R]
|
|
584 |
Replays the valid history without displaying it.
|
|
585 |
Errors are displayed.
|
|
586 |
.RS
|
|
587 |
.RE
|
|
588 |
.TP
|
|
589 |
.B \f[CB]\-restore\f[R]
|
|
590 |
Resets the environment to the state at the start of the previous run of
|
|
591 |
the tool or to the last time a \f[CB]/reset\f[R], \f[CB]/reload\f[R], or
|
|
592 |
\f[CB]/env\f[R] command was executed in the previous run.
|
|
593 |
The valid history since that point is replayed.
|
|
594 |
Use this option to restore a previous JShell session.
|
|
595 |
.RS
|
|
596 |
.RE
|
|
597 |
.RE
|
|
598 |
.TP
|
|
599 |
.B \f[CB]/reset\f[R] [\f[I]options\f[R]]
|
|
600 |
Discards all entered snippets and restarts the session as follows:
|
|
601 |
.RS
|
|
602 |
.IP \[bu] 2
|
|
603 |
Updates the environment settings with the provided options, if any.
|
|
604 |
.IP \[bu] 2
|
|
605 |
Resets the execution state.
|
|
606 |
.IP \[bu] 2
|
|
607 |
Runs the startup scripts.
|
|
608 |
.PP
|
|
609 |
History is not replayed.
|
|
610 |
All code that was entered is lost.
|
|
611 |
.PP
|
|
612 |
Environment settings entered on the command line or provided with a
|
|
613 |
previous \f[CB]/reset\f[R], \f[CB]/env\f[R], or \f[CB]/reload\f[R] command are
|
|
614 |
maintained unless an \f[I]option\f[R] is entered that overwrites the
|
|
615 |
setting.
|
|
616 |
.PP
|
|
617 |
The following options are valid:
|
|
618 |
.TP
|
|
619 |
.B \f[CB]\-\-add\-modules\f[R] \f[I]module\f[R][\f[CB],\f[R]\f[I]module\f[R]...]
|
|
620 |
Specifies the root modules to resolve in addition to the initial module.
|
|
621 |
.RS
|
|
622 |
.RE
|
|
623 |
.TP
|
|
624 |
.B \f[CB]\-\-add\-exports\f[R] \f[I]source\-module\f[R]\f[CB]/\f[R]\f[I]package\f[R]\f[CB]=\f[R]\f[I]target\-module\f[R][\f[CB],\f[R]\f[I]target\-module\f[R]]*
|
|
625 |
Adds an export of \f[I]package\f[R] from \f[I]source\-module\f[R] to
|
|
626 |
\f[I]target\-module\f[R].
|
|
627 |
.RS
|
|
628 |
.RE
|
|
629 |
.TP
|
|
630 |
.B \f[CB]\-\-class\-path\f[R] \f[I]path\f[R]
|
|
631 |
Specifies the directories and archives that are searched to locate class
|
|
632 |
files.
|
|
633 |
This option overrides the path in the \f[CB]CLASSPATH\f[R] environment
|
|
634 |
variable.
|
|
635 |
If the environment variable isn\[aq]t set and this option isn\[aq]t
|
|
636 |
used, then the current directory is searched.
|
|
637 |
For Oracle Solaris, Linux, and macOS, use a colon (\f[CB]:\f[R]) to
|
|
638 |
separate items in the path.
|
|
639 |
For Windows, use a semicolon (\f[CB];\f[R]) to separate items.
|
|
640 |
.RS
|
|
641 |
.RE
|
|
642 |
.TP
|
|
643 |
.B \f[CB]\-\-module\-path\f[R] \f[I]modulepath\f[R]
|
|
644 |
Specifies where to find application modules.
|
|
645 |
For Oracle Solaris, Linux, and macOS, use a colon (\f[CB]:\f[R]) to
|
|
646 |
separate items in the path.
|
|
647 |
For Windows, use a semicolon (\f[CB];\f[R]) to separate items.
|
|
648 |
.RS
|
|
649 |
.RE
|
|
650 |
.RE
|
|
651 |
.TP
|
|
652 |
.B \f[CB]/save\f[R] [\f[I]options\f[R]] \f[I]file\f[R]
|
|
653 |
Saves snippets and commands to the file specified.
|
|
654 |
If no options are entered, then active snippets are saved.
|
|
655 |
.RS
|
|
656 |
.PP
|
|
657 |
The following options are valid:
|
|
658 |
.TP
|
|
659 |
.B {\f[I]name\f[R]|\f[I]id\f[R]|\f[I]startID\f[R]\f[CB]\-\f[R]\f[I]endID\f[R]} [{\f[I]name\f[R]|\f[I]id\f[R]|\f[I]startID\f[R]\f[CB]\-\f[R]\f[I]endID\f[R]}...]
|
|
660 |
Saves the snippets and commands identified by name, ID, or ID range.
|
|
661 |
For a range of IDs, provide the starting ID and ending ID separated with
|
|
662 |
a hyphen.
|
|
663 |
To provide a list, separate the items in the list with a space.
|
|
664 |
Use the \f[CB]/list\f[R] command to see the IDs of the code snippets.
|
|
665 |
.RS
|
|
666 |
.RE
|
|
667 |
.TP
|
|
668 |
.B \f[CB]\-all\f[R]
|
|
669 |
Saves all snippets, including startup snippets and snippets that were
|
|
670 |
overwritten or failed.
|
|
671 |
.RS
|
|
672 |
.RE
|
|
673 |
.TP
|
|
674 |
.B \f[CB]\-history\f[R]
|
|
675 |
Saves the sequential history of all commands and snippets entered in the
|
|
676 |
current session.
|
|
677 |
.RS
|
|
678 |
.RE
|
|
679 |
.TP
|
|
680 |
.B \f[CB]\-start\f[R]
|
|
681 |
Saves the current startup settings.
|
|
682 |
If no startup scripts were provided, then an empty file is saved.
|
|
683 |
.RS
|
|
684 |
.RE
|
|
685 |
.RE
|
|
686 |
.TP
|
|
687 |
.B \f[CB]/set\f[R] [\f[I]setting\f[R]]
|
|
688 |
Sets configuration information, including the external editor, startup
|
|
689 |
settings, and feedback mode.
|
|
690 |
This command is also used to create a custom feedback mode with
|
|
691 |
customized prompt, format, and truncation values.
|
|
692 |
If no setting is entered, then the current setting for the editor,
|
|
693 |
startup settings, and feedback mode are displayed.
|
|
694 |
.RS
|
|
695 |
.PP
|
|
696 |
The following values are valid for \f[CB]setting\f[R]:
|
|
697 |
.TP
|
|
698 |
.B \f[CB]editor\f[R] [\f[I]options\f[R]] [\f[I]command\f[R]]
|
|
699 |
Sets the command used to start an external editor when the
|
|
700 |
\f[CB]/edit\f[R] command is entered.
|
|
701 |
The command can include command arguments separated by spaces.
|
|
702 |
If no command or options are entered, then the current setting is
|
|
703 |
displayed.
|
|
704 |
.RS
|
|
705 |
.PP
|
|
706 |
The following options are valid:
|
|
707 |
.TP
|
|
708 |
.B \f[CB]\-default\f[R]
|
|
709 |
Sets the editor to the default editor provided with JShell.
|
|
710 |
This option can\[aq]t be used if a command for starting an editor is
|
|
711 |
entered.
|
|
712 |
.RS
|
|
713 |
.RE
|
|
714 |
.TP
|
|
715 |
.B \f[CB]\-delete\f[R]
|
|
716 |
Sets the editor to the one in effect when the session started.
|
|
717 |
If used with the \f[CB]\-retain\f[R] option, then the retained editor
|
|
718 |
setting is deleted and the editor is set to the first of the following
|
|
719 |
environment variables found: \f[CB]JSHELLEDITOR\f[R], \f[CB]VISUAL\f[R], or
|
|
720 |
\f[CB]EDITOR\f[R].
|
|
721 |
If none of the editor environment variables are set, then this option
|
|
722 |
sets the editor to the default editor.
|
|
723 |
.RS
|
|
724 |
.PP
|
|
725 |
This option can\[aq]t be used if a command for starting an editor is
|
|
726 |
entered.
|
|
727 |
.RE
|
|
728 |
.TP
|
|
729 |
.B \f[CB]\-retain\f[R]
|
|
730 |
Saves the editor setting across sessions.
|
|
731 |
If no other option or a command is entered, then the current setting is
|
|
732 |
saved.
|
|
733 |
.RS
|
|
734 |
.RE
|
|
735 |
.TP
|
|
736 |
.B \f[CB]\-wait\f[R]
|
|
737 |
Prompts the user to indicate when editing is complete.
|
|
738 |
Otherwise control returns to JShell when the editor exits.
|
|
739 |
Use this option if the editor being used exits immediately, for example,
|
|
740 |
when an edit window already exists.
|
|
741 |
This option is valid only when a command for starting an editor is
|
|
742 |
entered.
|
|
743 |
.RS
|
|
744 |
.RE
|
|
745 |
.RE
|
|
746 |
.TP
|
|
747 |
.B \f[CB]feedback\f[R] [\f[I]mode\f[R]]
|
|
748 |
Sets the feedback mode used to respond to input.
|
|
749 |
If no mode is entered, then the current mode is displayed.
|
|
750 |
.RS
|
|
751 |
.PP
|
|
752 |
The following modes are valid: \f[CB]concise\f[R], \f[CB]normal\f[R],
|
|
753 |
\f[CB]silent\f[R], \f[CB]verbose\f[R], and any custom mode created with the
|
|
754 |
\f[CB]/set\ mode\f[R] command.
|
|
755 |
.RE
|
|
756 |
.TP
|
|
757 |
.B \f[CB]format\f[R] \f[I]mode\f[R] \f[I]field\f[R] \f[CB]"\f[R]\f[I]format\-string\f[R]\f[CB]"\f[R] \f[I]selector\f[R]
|
|
758 |
Sets the format of the feedback provided in response to input.
|
|
759 |
If no mode is entered, then the current formats for all fields for all
|
|
760 |
feedback modes are displayed.
|
|
761 |
If only a mode is entered, then the current formats for that mode are
|
|
762 |
displayed.
|
|
763 |
If only a mode and field are entered, then the current formats for that
|
|
764 |
field are displayed.
|
|
765 |
.RS
|
|
766 |
.PP
|
|
767 |
To define a format, the following arguments are required:
|
|
768 |
.TP
|
|
769 |
.B \f[I]mode\f[R]
|
|
770 |
Specifies a feedback mode to which the response format is applied.
|
|
771 |
Only custom modes created with the \f[CB]/set\ mode\f[R] command can be
|
|
772 |
modified.
|
|
773 |
.RS
|
|
774 |
.RE
|
|
775 |
.TP
|
|
776 |
.B \f[I]field\f[R]
|
|
777 |
Specifies a context\-specific field to which the response format is
|
|
778 |
applied.
|
|
779 |
The fields are described in the online help, which is accessed from
|
|
780 |
JShell using the \f[CB]/help\ /set\ format\f[R] command.
|
|
781 |
.RS
|
|
782 |
.RE
|
|
783 |
.TP
|
|
784 |
.B \f[CB]"\f[R]\f[I]format\-string\f[R]\f[CB]"\f[R]
|
|
785 |
Specifies the string to use as the response format for the specified
|
|
786 |
field and selector.
|
|
787 |
The structure of the format string is described in the online help,
|
|
788 |
which is accessed from JShell using the \f[CB]/help\ /set\ format\f[R]
|
|
789 |
command.
|
|
790 |
.RS
|
|
791 |
.RE
|
|
792 |
.TP
|
|
793 |
.B \f[I]selector\f[R]
|
|
794 |
Specifies the context in which the response format is applied.
|
|
795 |
The selectors are described in the online help, which is accessed from
|
|
796 |
JShell using the \f[CB]/help\ /set\ format\f[R] command.
|
|
797 |
.RS
|
|
798 |
.RE
|
|
799 |
.RE
|
|
800 |
.TP
|
|
801 |
.B \f[CB]mode\f[R] [\f[I]mode\-name\f[R]] [\f[I]existing\-mode\f[R]] [\f[I]options\f[R]]
|
|
802 |
Creates a custom feedback mode with the mode name provided.
|
|
803 |
If no mode name is entered, then the settings for all modes are
|
|
804 |
displayed, which includes the mode, prompt, format, and truncation
|
|
805 |
settings.
|
|
806 |
If the name of an existing mode is provided, then the settings from the
|
|
807 |
existing mode are copied to the mode being created.
|
|
808 |
.RS
|
|
809 |
.PP
|
|
810 |
The following options are valid:
|
|
811 |
.TP
|
|
812 |
.B \f[CB]\-command\f[R]|\f[CB]\-quiet\f[R]
|
|
813 |
Specifies the level of feedback displayed for commands when using the
|
|
814 |
mode.
|
|
815 |
This option is required when creating a feedback mode.
|
|
816 |
Use \f[CB]\-command\f[R] to show information and verification feedback for
|
|
817 |
commands.
|
|
818 |
Use \f[CB]\-quiet\f[R] to show only essential feedback for commands, such
|
|
819 |
as error messages.
|
|
820 |
.RS
|
|
821 |
.RE
|
|
822 |
.TP
|
|
823 |
.B \f[CB]\-delete\f[R]
|
|
824 |
Deletes the named feedback mode for this session.
|
|
825 |
The name of the mode to delete is required.
|
|
826 |
To permanently delete a retained mode, use the \f[CB]\-retain\f[R] option
|
|
827 |
with this option.
|
|
828 |
Predefined modes can\[aq]t be deleted.
|
|
829 |
.RS
|
|
830 |
.RE
|
|
831 |
.TP
|
|
832 |
.B \f[CB]\-retain\f[R]
|
|
833 |
Saves the named feedback mode across sessions.
|
|
834 |
The name of the mode to retain is required.
|
|
835 |
.RS
|
|
836 |
.RE
|
|
837 |
.PP
|
|
838 |
Configure the new feedback mode using the \f[CB]/set\ prompt\f[R],
|
|
839 |
\f[CB]/set\ format\f[R], and \f[CB]/set\ truncation\f[R] commands.
|
|
840 |
.PP
|
|
841 |
To start using the new mode, use the \f[CB]/set\ feedback\f[R] command.
|
|
842 |
.RE
|
|
843 |
.TP
|
|
844 |
.B \f[CB]prompt\f[R] \f[I]mode\f[R] \f[CB]"\f[R]\f[I]prompt\-string\f[R]\f[CB]"\f[R] \f[CB]"\f[R]\f[I]continuation\-prompt\-string\f[R]\f[CB]"\f[R]
|
|
845 |
Sets the prompts for input within JShell.
|
|
846 |
If no mode is entered, then the current prompts for all feedback modes
|
|
847 |
are displayed.
|
|
848 |
If only a mode is entered, then the current prompts for that mode are
|
|
849 |
displayed.
|
|
850 |
.RS
|
|
851 |
.PP
|
|
852 |
To define a prompt, the following arguments are required:
|
|
853 |
.TP
|
|
854 |
.B \f[I]mode\f[R]
|
|
855 |
Specifies the feedback mode to which the prompts are applied.
|
|
856 |
Only custom modes created with the \f[CB]/set\ mode\f[R] command can be
|
|
857 |
modified.
|
|
858 |
.RS
|
|
859 |
.RE
|
|
860 |
.TP
|
|
861 |
.B \f[CB]"\f[R]\f[I]prompt\-string\f[R]\f[CB]"\f[R]
|
|
862 |
Specifies the string to use as the prompt for the first line of input.
|
|
863 |
.RS
|
|
864 |
.RE
|
|
865 |
.TP
|
|
866 |
.B \f[CB]"\f[R]\f[I]continuation\-prompt\-string\f[R]\f[CB]"\f[R]
|
|
867 |
Specifies the string to use as the prompt for the additional input lines
|
|
868 |
needed to complete a snippet.
|
|
869 |
.RS
|
|
870 |
.RE
|
|
871 |
.RE
|
|
872 |
.TP
|
|
873 |
.B \f[CB]start\f[R] [\f[CB]\-retain\f[R]] [\f[I]file\f[R] [\f[I]file\f[R]...]|\f[I]option\f[R]]
|
|
874 |
Sets the names of the startup scripts used when the next
|
|
875 |
\f[CB]/reset\f[R], \f[CB]/reload\f[R], or \f[CB]/env\f[R] command is entered.
|
|
876 |
If more than one script is entered, then the scripts are run in the
|
|
877 |
order entered.
|
|
878 |
If no scripts or options are entered, then the current startup settings
|
|
879 |
are displayed.
|
|
880 |
.RS
|
|
881 |
.PP
|
|
882 |
The scripts can be local files or one of the following predefined
|
|
883 |
scripts:
|
|
884 |
.TP
|
|
885 |
.B \f[CB]DEFAULT\f[R]
|
|
886 |
Loads the default entries, which are commonly used as imports.
|
|
887 |
.RS
|
|
888 |
.RE
|
|
889 |
.TP
|
|
890 |
.B \f[CB]JAVASE\f[R]
|
|
891 |
Imports all Java SE packages.
|
|
892 |
.RS
|
|
893 |
.RE
|
|
894 |
.TP
|
|
895 |
.B \f[CB]PRINTING\f[R]
|
|
896 |
Defines \f[CB]print\f[R], \f[CB]println\f[R], and \f[CB]printf\f[R] as
|
|
897 |
\f[CB]jshell\f[R] methods for use within the tool.
|
|
898 |
.RS
|
|
899 |
.RE
|
|
900 |
.PP
|
|
901 |
The following options are valid:
|
|
902 |
.TP
|
|
903 |
.B \f[CB]\-default\f[R]
|
|
904 |
Sets the startup settings to the default settings.
|
|
905 |
.RS
|
|
906 |
.RE
|
|
907 |
.TP
|
|
908 |
.B \f[CB]\-none\f[R]
|
|
909 |
Specifies that no startup settings are used.
|
|
910 |
.RS
|
|
911 |
.RE
|
|
912 |
.PP
|
|
913 |
Use the \f[CB]\-retain\f[R] option to save the start setting across
|
|
914 |
sessions.
|
|
915 |
.RE
|
|
916 |
.TP
|
|
917 |
.B \f[CB]truncation\f[R] \f[I]mode\f[R] \f[I]length\f[R] \f[I]selector\f[R]
|
|
918 |
Sets the maximum length of a displayed value.
|
|
919 |
If no mode is entered, then the current truncation values for all
|
|
920 |
feedback modes are displayed.
|
|
921 |
If only a mode is entered, then the current truncation values for that
|
|
922 |
mode are displayed.
|
|
923 |
.RS
|
|
924 |
.PP
|
|
925 |
To define truncation values, the following arguments are required:
|
|
926 |
.TP
|
|
927 |
.B \f[I]mode\f[R]
|
|
928 |
Specifies the feedback mode to which the truncation value is applied.
|
|
929 |
Only custom modes created with the \f[CB]/set\ mode\f[R] command can be
|
|
930 |
modified.
|
|
931 |
.RS
|
|
932 |
.RE
|
|
933 |
.TP
|
|
934 |
.B \f[I]length\f[R]
|
|
935 |
Specifies the unsigned integer to use as the maximum length for the
|
|
936 |
specified selector.
|
|
937 |
.RS
|
|
938 |
.RE
|
|
939 |
.TP
|
|
940 |
.B \f[I]selector\f[R]
|
|
941 |
Specifies the context in which the truncation value is applied.
|
|
942 |
The selectors are described in the online help, which is accessed from
|
|
943 |
JShell using the \f[CB]/help\ /set\ truncation\f[R] command.
|
|
944 |
.RS
|
|
945 |
.RE
|
|
946 |
.RE
|
|
947 |
.RE
|
|
948 |
.TP
|
|
949 |
.B \f[CB]/types\f[R] [\f[I]option\f[R]]
|
|
950 |
Displays classes, interfaces, and enums that were entered.
|
|
951 |
If no option is entered, then all current active classes, interfaces,
|
|
952 |
and enums are displayed.
|
|
953 |
.RS
|
|
954 |
.PP
|
|
955 |
The following options are valid:
|
|
956 |
.TP
|
|
957 |
.B {\f[I]name\f[R]|\f[I]id\f[R]|\f[I]startID\f[R]\f[CB]\-\f[R]\f[I]endID\f[R]} [{\f[I]name\f[R]|\f[I]id\f[R]|\f[I]startID\f[R]\f[CB]\-\f[R]\f[I]endID\f[R]}...]
|
|
958 |
Displays information for classes, interfaces, and enums identified by
|
|
959 |
name, ID, or ID range.
|
|
960 |
For a range of IDs, provide the starting ID and ending ID separated with
|
|
961 |
a hyphen.
|
|
962 |
To provide a list, separate the items in the list with a space.
|
|
963 |
Use the \f[CB]/list\f[R] command to see the IDs of the code snippets.
|
|
964 |
.RS
|
|
965 |
.RE
|
|
966 |
.TP
|
|
967 |
.B \f[CB]\-all\f[R]
|
|
968 |
Displays information for all classes, interfaces, and enums, including
|
|
969 |
those added when JShell was started, and classes, interfaces, and enums
|
|
970 |
that failed, were overwritten, or were dropped.
|
|
971 |
.RS
|
|
972 |
.RE
|
|
973 |
.TP
|
|
974 |
.B \f[CB]\-start\f[R]
|
|
975 |
Displays information for startup classes, interfaces, and enums that
|
|
976 |
were added when JShell was started.
|
|
977 |
.RS
|
|
978 |
.RE
|
|
979 |
.RE
|
|
980 |
.TP
|
|
981 |
.B \f[CB]/vars\f[R] [\f[I]option\f[R]]
|
|
982 |
Displays the name, type, and value of variables that were entered.
|
|
983 |
If no option is entered, then all current active variables are
|
|
984 |
displayed.
|
|
985 |
.RS
|
|
986 |
.PP
|
|
987 |
The following options are valid:
|
|
988 |
.TP
|
|
989 |
.B {\f[I]name\f[R]|\f[I]id\f[R]|\f[I]startID\f[R]\f[CB]\-\f[R]\f[I]endID\f[R]} [{\f[I]name\f[R]|\f[I]id\f[R]|\f[I]startID\f[R]\f[CB]\-\f[R]\f[I]endID\f[R]}...]
|
|
990 |
Displays information for variables identified by name, ID, or ID range.
|
|
991 |
For a range of IDs, provide the starting ID and ending ID separated with
|
|
992 |
a hyphen.
|
|
993 |
To provide a list, separate the items in the list with a space.
|
|
994 |
Use the \f[CB]/list\f[R] command to see the IDs of the code snippets.
|
|
995 |
.RS
|
|
996 |
.RE
|
|
997 |
.TP
|
|
998 |
.B \f[CB]\-all\f[R]
|
|
999 |
Displays information for all variables, including those added when
|
|
1000 |
JShell was started, and variables that failed, were overwritten, or were
|
|
1001 |
dropped.
|
|
1002 |
.RS
|
|
1003 |
.RE
|
|
1004 |
.TP
|
|
1005 |
.B \f[CB]\-start\f[R]
|
|
1006 |
Displays information for startup variables that were added when JShell
|
|
1007 |
was started.
|
|
1008 |
.RS
|
|
1009 |
.RE
|
|
1010 |
.RE
|
|
1011 |
.TP
|
|
1012 |
.B \f[CB]/?\f[R]
|
|
1013 |
Same as the \f[CB]/help\f[R] command.
|
|
1014 |
.RS
|
|
1015 |
.RE
|
|
1016 |
.TP
|
|
1017 |
.B \f[CB]/!\f[R]
|
|
1018 |
Reruns the last snippet.
|
|
1019 |
.RS
|
|
1020 |
.RE
|
|
1021 |
.TP
|
|
1022 |
.B \f[CB]/\f[R]{\f[I]name\f[R]|\f[I]id\f[R]|\f[I]startID\f[R]\f[CB]\-\f[R]\f[I]endID\f[R]} [{\f[I]name\f[R]|\f[I]id\f[R]|\f[I]startID\f[R]\f[CB]\-\f[R]\f[I]endID\f[R]}...]
|
|
1023 |
Reruns the snippets identified by ID, range of IDs, or name.
|
|
1024 |
For a range of IDs, provide the starting ID and ending ID separated with
|
|
1025 |
a hyphen.
|
|
1026 |
To provide a list, separate the items in the list with a space.
|
|
1027 |
The first item in the list must be an ID or ID range.
|
|
1028 |
Use the \f[CB]/list\f[R] command to see the IDs of the code snippets.
|
|
1029 |
.RS
|
|
1030 |
.RE
|
|
1031 |
.TP
|
|
1032 |
.B \f[CB]/\-\f[R]\f[I]n\f[R]
|
|
1033 |
Reruns the \-\f[I]n\f[R]th previous snippet.
|
|
1034 |
For example, if 15 code snippets were entered, then \f[CB]/\-4\f[R] runs
|
|
1035 |
the 11th snippet.
|
|
1036 |
Commands aren\[aq]t included in the count.
|
|
1037 |
.RS
|
|
1038 |
.RE
|
|
1039 |
.SH INPUT SHORTCUTS
|
|
1040 |
.PP
|
|
1041 |
The following shortcuts are available for entering commands and snippets
|
|
1042 |
in JShell.
|
|
1043 |
.SS Tab completion
|
|
1044 |
.TP
|
|
1045 |
.B \f[B]<tab>\f[R]
|
|
1046 |
When entering snippets, commands, subcommands, command arguments, or
|
|
1047 |
command options, use the Tab key to automatically complete the item.
|
|
1048 |
If the item can\[aq]t be determined from what was entered, then possible
|
|
1049 |
options are provided.
|
|
1050 |
.RS
|
|
1051 |
.PP
|
|
1052 |
When entering a method call, use the Tab key after the method call\[aq]s
|
|
1053 |
opening parenthesis to see the parameters for the method.
|
|
1054 |
If the method has more than one signature, then all signatures are
|
|
1055 |
displayed.
|
|
1056 |
Pressing the Tab key a second time displays the description of the
|
|
1057 |
method and the parameters for the first signature.
|
|
1058 |
Continue pressing the Tab key for a description of any additional
|
|
1059 |
signatures.
|
|
1060 |
.RE
|
|
1061 |
.TP
|
|
1062 |
.B \f[B]Shift+<Tab> V\f[R]
|
|
1063 |
After entering a complete expression, use this key sequence to convert
|
|
1064 |
the expression to a variable declaration of a type determined by the
|
|
1065 |
type of the expression.
|
|
1066 |
.RS
|
|
1067 |
.RE
|
|
1068 |
.TP
|
|
1069 |
.B \f[B]Shift+<Tab> M\f[R]
|
|
1070 |
After entering a complete expression or statement, use this key sequence
|
|
1071 |
to convert the expression or statement to a method declaration.
|
|
1072 |
If an expression is entered, the return type is based on the type of the
|
|
1073 |
expression.
|
|
1074 |
.RS
|
|
1075 |
.RE
|
|
1076 |
.TP
|
|
1077 |
.B \f[B]Shift+<Tab> I\f[R]
|
|
1078 |
When an identifier is entered that can\[aq]t be resolved, use this key
|
|
1079 |
sequence to show possible imports that resolve the identifier based on
|
|
1080 |
the content of the specified class path.
|
|
1081 |
.RS
|
|
1082 |
.RE
|
|
1083 |
.SS Command abbreviations
|
|
1084 |
.PP
|
|
1085 |
An abbreviation of a command is accepted if the abbreviation uniquely
|
|
1086 |
identifies a command.
|
|
1087 |
For example, \f[CB]/l\f[R] is recognized as the \f[CB]/list\f[R] command.
|
|
1088 |
However, \f[CB]/s\f[R] isn\[aq]t a valid abbreviation because it can\[aq]t
|
|
1089 |
be determined if the \f[CB]/set\f[R] or \f[CB]/save\f[R] command is meant.
|
|
1090 |
Use \f[CB]/se\f[R] for the \f[CB]/set\f[R] command or \f[CB]/sa\f[R] for the
|
|
1091 |
\f[CB]/save\f[R] command.
|
|
1092 |
.PP
|
|
1093 |
Abbreviations are also accepted for subcommands, command arguments, and
|
|
1094 |
command options.
|
|
1095 |
For example, use \f[CB]/m\ \-a\f[R] to display all methods.
|
|
1096 |
.SS History navigation
|
|
1097 |
.PP
|
|
1098 |
A history of what was entered is maintained across sessions.
|
|
1099 |
Use the up and down arrows to scroll through commands and snippets from
|
|
1100 |
the current and past sessions.
|
|
1101 |
Use the Ctrl key with the up and down arrows to skip all but the first
|
|
1102 |
line of multiline snippets.
|
|
1103 |
.SS History search
|
|
1104 |
.PP
|
|
1105 |
Use the Ctrl+R key combination to search the history for the string
|
|
1106 |
entered.
|
|
1107 |
The prompt changes to show the string and the match.
|
|
1108 |
Ctrl+R searches backwards from the current location in the history
|
|
1109 |
through earlier entries.
|
|
1110 |
Ctrl+S searches forward from the current location in the history though
|
|
1111 |
later entries.
|
|
1112 |
.SH INPUT EDITING
|
|
1113 |
.PP
|
|
1114 |
The editing capabilities of JShell are similar to that of other common
|
|
1115 |
shells.
|
|
1116 |
Keyboard keys and key combinations provide line editing shortcuts.
|
|
1117 |
The Ctrl key and Meta key are used in key combinations.
|
|
1118 |
If your keyboard doesn\[aq]t have a Meta key, then the Alt key is often
|
|
1119 |
mapped to provide Meta key functionality.
|
|
1120 |
.PP
|
|
1121 |
.TS
|
|
1122 |
tab(@);
|
|
1123 |
l l.
|
|
1124 |
T{
|
|
1125 |
Key or Key Combination
|
|
1126 |
T}@T{
|
|
1127 |
Action
|
|
1128 |
T}
|
|
1129 |
_
|
|
1130 |
T{
|
|
1131 |
Return
|
|
1132 |
T}@T{
|
|
1133 |
Enter the current line.
|
|
1134 |
T}
|
|
1135 |
T{
|
|
1136 |
Left arrow
|
|
1137 |
T}@T{
|
|
1138 |
Move the cursor to the left one character.
|
|
1139 |
T}
|
|
1140 |
T{
|
|
1141 |
Right arrow
|
|
1142 |
T}@T{
|
|
1143 |
Move the cursor to the right one character.
|
|
1144 |
T}
|
|
1145 |
T{
|
|
1146 |
Ctrl+A
|
|
1147 |
T}@T{
|
|
1148 |
Move the cursor to the beginning of the line.
|
|
1149 |
T}
|
|
1150 |
T{
|
|
1151 |
Ctrl+E
|
|
1152 |
T}@T{
|
|
1153 |
Move the cursor to the end of the line.
|
|
1154 |
T}
|
|
1155 |
T{
|
|
1156 |
Meta+B
|
|
1157 |
T}@T{
|
|
1158 |
Move the cursor to the left one word.
|
|
1159 |
T}
|
|
1160 |
T{
|
|
1161 |
Meta+F
|
|
1162 |
T}@T{
|
|
1163 |
Move the cursor to the right one word.
|
|
1164 |
T}
|
|
1165 |
T{
|
|
1166 |
Delete
|
|
1167 |
T}@T{
|
|
1168 |
Delete the character under the cursor.
|
|
1169 |
T}
|
|
1170 |
T{
|
|
1171 |
Backspace
|
|
1172 |
T}@T{
|
|
1173 |
Delete the character before the cursor.
|
|
1174 |
T}
|
|
1175 |
T{
|
|
1176 |
Ctrl+K
|
|
1177 |
T}@T{
|
|
1178 |
Delete the text from the cursor to the end of the line.
|
|
1179 |
T}
|
|
1180 |
T{
|
|
1181 |
Meta+D
|
|
1182 |
T}@T{
|
|
1183 |
Delete the text from the cursor to the end of the word.
|
|
1184 |
T}
|
|
1185 |
T{
|
|
1186 |
Ctrl+W
|
|
1187 |
T}@T{
|
|
1188 |
Delete the text from the cursor to the previous white space.
|
|
1189 |
T}
|
|
1190 |
T{
|
|
1191 |
Ctrl+Y
|
|
1192 |
T}@T{
|
|
1193 |
Paste the most recently deleted text into the line.
|
|
1194 |
T}
|
|
1195 |
T{
|
|
1196 |
Meta+Y
|
|
1197 |
T}@T{
|
|
1198 |
After Ctrl+Y, press to cycle through the previously deleted text.
|
|
1199 |
T}
|
|
1200 |
.TE
|
|
1201 |
.SH EXAMPLE OF STARTING AND STOPPING A JSHELL SESSION
|
|
1202 |
.PP
|
|
1203 |
JShell is provided with the JDK.
|
|
1204 |
To start a session, enter \f[CB]jshell\f[R] on the command line.
|
|
1205 |
A welcome message is printed, and a prompt for entering commands and
|
|
1206 |
snippets is provided.
|
|
1207 |
.IP
|
|
1208 |
.nf
|
|
1209 |
\f[CB]
|
|
1210 |
%\ jshell
|
|
1211 |
|\ \ Welcome\ to\ JShell\ \-\-\ Version\ 9
|
|
1212 |
|\ \ For\ an\ introduction\ type:\ /help\ intro
|
|
1213 |
|
|
1214 |
jshell>
|
|
1215 |
\f[R]
|
|
1216 |
.fi
|
|
1217 |
.PP
|
|
1218 |
To see which snippets were automatically loaded when JShell started, use
|
|
1219 |
the \f[CB]/list\ \-start\f[R] command.
|
|
1220 |
The default startup snippets are import statements for common packages.
|
|
1221 |
The ID for each snippet begins with the letter \f[I]s\f[R], which
|
|
1222 |
indicates it\[aq]s a startup snippet.
|
|
1223 |
.IP
|
|
1224 |
.nf
|
|
1225 |
\f[CB]
|
|
1226 |
jshell>\ /list\ \-start
|
|
1227 |
|
|
1228 |
\ \ s1\ :\ import\ java.io.*;
|
|
1229 |
\ \ s2\ :\ import\ java.math.*;
|
|
1230 |
\ \ s3\ :\ import\ java.net.*;
|
|
1231 |
\ \ s4\ :\ import\ java.nio.file.*;
|
|
1232 |
\ \ s5\ :\ import\ java.util.*;
|
|
1233 |
\ \ s6\ :\ import\ java.util.concurrent.*;
|
|
1234 |
\ \ s7\ :\ import\ java.util.function.*;
|
|
1235 |
\ \ s8\ :\ import\ java.util.prefs.*;
|
|
1236 |
\ \ s9\ :\ import\ java.util.regex.*;
|
|
1237 |
\ s10\ :\ import\ java.util.stream.*;
|
|
1238 |
|
|
1239 |
jshell>
|
|
1240 |
\f[R]
|
|
1241 |
.fi
|
|
1242 |
.PP
|
|
1243 |
To end the session, use the \f[CB]/exit\f[R] command.
|
|
1244 |
.IP
|
|
1245 |
.nf
|
|
1246 |
\f[CB]
|
|
1247 |
jshell>\ /exit
|
|
1248 |
|\ \ Goodbye
|
|
1249 |
|
|
1250 |
%
|
|
1251 |
\f[R]
|
|
1252 |
.fi
|
|
1253 |
.SH EXAMPLE OF ENTERING SNIPPETS
|
|
1254 |
.PP
|
|
1255 |
Snippets are Java statements, variable definitions, method definitions,
|
|
1256 |
class definitions, import statements, and expressions.
|
|
1257 |
Terminating semicolons are automatically added to the end of a completed
|
|
1258 |
snippet if they\[aq]re missing.
|
|
1259 |
.PP
|
|
1260 |
The following example shows two variables and a method being defined,
|
|
1261 |
and the method being run.
|
|
1262 |
Note that a scratch variable is automatically created to hold the result
|
|
1263 |
because no variable was provided.
|
|
1264 |
.IP
|
|
1265 |
.nf
|
|
1266 |
\f[CB]
|
|
1267 |
jshell>\ int\ a=4
|
|
1268 |
a\ ==>\ 4
|
|
1269 |
|
|
1270 |
jshell>\ int\ b=8
|
|
1271 |
b\ ==>\ 8
|
|
1272 |
|
|
1273 |
jshell>\ int\ square(int\ i1)\ {
|
|
1274 |
\ \ \ ...>\ return\ i1\ *\ i1;
|
|
1275 |
\ \ \ ...>\ }
|
|
1276 |
|\ \ created\ method\ square(int)
|
|
1277 |
|
|
1278 |
jshell>\ square(b)
|
|
1279 |
$5\ ==>\ 64
|
|
1280 |
\f[R]
|
|
1281 |
.fi
|
|
1282 |
.SH EXAMPLE OF CHANGING SNIPPETS
|
|
1283 |
.PP
|
|
1284 |
Change the definition of a variable, method, or class by entering it
|
|
1285 |
again.
|
|
1286 |
.PP
|
|
1287 |
The following examples shows a method being defined and the method run:
|
|
1288 |
.IP
|
|
1289 |
.nf
|
|
1290 |
\f[CB]
|
|
1291 |
jshell>\ String\ grade(int\ testScore)\ {
|
|
1292 |
\ \ \ ...>\ \ \ \ \ if\ (testScore\ >=\ 90)\ {
|
|
1293 |
\ \ \ ...>\ \ \ \ \ \ \ \ \ return\ "Pass";
|
|
1294 |
\ \ \ ...>\ \ \ \ \ }
|
|
1295 |
\ \ \ ...>\ \ \ \ \ return\ "Fail";
|
|
1296 |
\ \ \ ...>\ }
|
|
1297 |
|\ \ created\ method\ grade(int)
|
|
1298 |
|
|
1299 |
jshell>\ grade(88)
|
|
1300 |
$3\ ==>\ "Fail"
|
|
1301 |
\f[R]
|
|
1302 |
.fi
|
|
1303 |
.PP
|
|
1304 |
To change the method \f[CB]grade\f[R] to allow more students to pass,
|
|
1305 |
enter the method definition again and change the pass score to
|
|
1306 |
\f[CB]80\f[R].
|
|
1307 |
Use the up arrow key to retrieve the previous entries to avoid having to
|
|
1308 |
reenter them and make the change in the \f[CB]if\f[R] statement.
|
|
1309 |
The following example shows the new definition and reruns the method to
|
|
1310 |
show the new result:
|
|
1311 |
.IP
|
|
1312 |
.nf
|
|
1313 |
\f[CB]
|
|
1314 |
jshell>\ String\ grade(int\ testScore)\ {
|
|
1315 |
\ \ \ ...>\ \ \ \ \ if\ (testScore\ >=\ 80)\ {
|
|
1316 |
\ \ \ ...>\ \ \ \ \ \ \ \ \ return\ "Pass";
|
|
1317 |
\ \ \ ...>\ \ \ \ \ }
|
|
1318 |
\ \ \ ...>\ \ \ \ \ return\ "Fail";
|
|
1319 |
\ \ \ ...>\ }
|
|
1320 |
|\ \ modified\ method\ grade(int)
|
|
1321 |
|
|
1322 |
jshell>\ grade(88)
|
|
1323 |
$5\ ==>\ "Pass"
|
|
1324 |
\f[R]
|
|
1325 |
.fi
|
|
1326 |
.PP
|
|
1327 |
For snippets that are more than a few lines long, or to make more than a
|
|
1328 |
few changes, use the \f[CB]/edit\f[R] command to open the snippet in an
|
|
1329 |
editor.
|
|
1330 |
After the changes are complete, close the edit window to return control
|
|
1331 |
to the JShell session.
|
|
1332 |
The following example shows the command and the feedback provided when
|
|
1333 |
the edit window is closed.
|
|
1334 |
The \f[CB]/list\f[R] command is used to show that the pass score was
|
|
1335 |
changed to \f[CB]85\f[R].
|
|
1336 |
.IP
|
|
1337 |
.nf
|
|
1338 |
\f[CB]
|
|
1339 |
jshell>\ /edit\ grade
|
|
1340 |
|\ \ modified\ method\ grade(int)
|
|
1341 |
jshell>\ /list\ grade
|
|
1342 |
|
|
1343 |
\ \ \ 6\ :\ String\ grade(int\ testScore)\ {
|
|
1344 |
\ \ \ \ \ \ \ \ \ \ \ if\ (testScore\ >=\ 85)\ {
|
|
1345 |
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ return\ "Pass";
|
|
1346 |
\ \ \ \ \ \ \ \ \ \ \ }
|
|
1347 |
\ \ \ \ \ \ \ \ \ \ \ return\ "Fail";
|
|
1348 |
\ \ \ \ \ \ \ }
|
|
1349 |
\f[R]
|
|
1350 |
.fi
|
|
1351 |
.SH EXAMPLE OF CREATING A CUSTOM FEEDBACK MODE
|
|
1352 |
.PP
|
|
1353 |
The feedback mode determines the prompt that\[aq]s displayed, the
|
|
1354 |
feedback messages that are provided as snippets are entered, and the
|
|
1355 |
maximum length of a displayed value.
|
|
1356 |
Predefined feedback modes are provided.
|
|
1357 |
Commands for creating custom feedback modes are also provided.
|
|
1358 |
.PP
|
|
1359 |
Use the \f[CB]/set\ mode\f[R] command to create a new feedback mode.
|
|
1360 |
In the following example, the new mode \f[CB]mymode\f[R], is based on the
|
|
1361 |
predefined feedback mode, \f[CB]normal\f[R], and verifying command
|
|
1362 |
feedback is displayed:
|
|
1363 |
.IP
|
|
1364 |
.nf
|
|
1365 |
\f[CB]
|
|
1366 |
jshell>\ /set\ mode\ mymode\ normal\ \-command
|
|
1367 |
|\ \ Created\ new\ feedback\ mode:\ mymode
|
|
1368 |
\f[R]
|
|
1369 |
.fi
|
|
1370 |
.PP
|
|
1371 |
Because the new mode is based on the \f[CB]normal\f[R] mode, the prompts
|
|
1372 |
are the same.
|
|
1373 |
The following example shows how to see what prompts are used and then
|
|
1374 |
changes the prompts to custom strings.
|
|
1375 |
The first string represents the standard JShell prompt.
|
|
1376 |
The second string represents the prompt for additional lines in
|
|
1377 |
multiline snippets.
|
|
1378 |
.IP
|
|
1379 |
.nf
|
|
1380 |
\f[CB]
|
|
1381 |
jshell>\ /set\ prompt\ mymode
|
|
1382 |
|\ \ /set\ prompt\ mymode\ "\\njshell>\ "\ "\ \ \ ...>\ "
|
|
1383 |
|
|
1384 |
jshell>\ /set\ prompt\ mymode\ "\\nprompt$\ "\ "\ \ \ continue$\ "
|
|
1385 |
\f[R]
|
|
1386 |
.fi
|
|
1387 |
.PP
|
|
1388 |
The maximum length of a displayed value is controlled by the truncation
|
|
1389 |
setting.
|
|
1390 |
Different types of values can have different lengths.
|
|
1391 |
The following example sets an overall truncation value of 72, and a
|
|
1392 |
truncation value of 500 for variable value expressions:
|
|
1393 |
.IP
|
|
1394 |
.nf
|
|
1395 |
\f[CB]
|
|
1396 |
jshell>\ /set\ truncation\ mymode\ 72
|
|
1397 |
|
|
1398 |
jshell>\ /set\ truncation\ mymode\ 500\ varvalue
|
|
1399 |
\f[R]
|
|
1400 |
.fi
|
|
1401 |
.PP
|
|
1402 |
The feedback displayed after snippets are entered is controlled by the
|
|
1403 |
format setting and is based on the type of snippet entered and the
|
|
1404 |
action taken for that snippet.
|
|
1405 |
In the predefined mode \f[CB]normal\f[R], the string \f[CB]created\f[R] is
|
|
1406 |
displayed when a method is created.
|
|
1407 |
The following example shows how to change that string to
|
|
1408 |
\f[CB]defined\f[R]:
|
|
1409 |
.IP
|
|
1410 |
.nf
|
|
1411 |
\f[CB]
|
|
1412 |
jshell>\ /set\ format\ mymode\ action\ "defined"\ added\-primary
|
|
1413 |
\f[R]
|
|
1414 |
.fi
|
|
1415 |
.PP
|
|
1416 |
Use the \f[CB]/set\ feedback\f[R] command to start using the feedback mode
|
|
1417 |
that was just created.
|
|
1418 |
The following example shows the custom mode in use:
|
|
1419 |
.IP
|
|
1420 |
.nf
|
|
1421 |
\f[CB]
|
|
1422 |
jshell>\ /set\ feedback\ mymode
|
|
1423 |
|\ \ Feedback\ mode:\ mymode
|
|
1424 |
|
|
1425 |
prompt$\ int\ square\ (int\ num1){
|
|
1426 |
\ \ \ continue$\ return\ num1*num1;
|
|
1427 |
\ \ \ continue$\ }
|
|
1428 |
|\ \ defined\ method\ square(int)
|
|
1429 |
|
|
1430 |
prompt$
|
|
1431 |
\f[R]
|
|
1432 |
.fi
|