/help| Tapez une expression, une instruction, un ordre du langage Java"/> /help| Tapez une expression, une instruction, un ordre du langage Java">

Maison  >  Article  >  Java  >  Comment obtenir la documentation JShell en Java 9 ?

Comment obtenir la documentation JShell en Java 9 ?

WBOY
WBOYavant
2023-09-06 16:45:031313parcourir

如何在Java 9中获取JShell文档?

Java 9 introduit un nouvel outil interactif appelé JShell. Cet outil peut être utilisé pour exécuter des expressions, des classes, des interfaces, des énumérations, etc.

Une documentation détaillée est disponible sur JShell, qui contient des informations complètes sur l'utilisation de ses commandes internes et de diverses options. Ce document est accessible à l'aide de deux commandes : "/help" et "/?". La documentation de JShell ne se limite pas aux informations sur ses contrôles internes, mais comprend également Javadoc.

Dans l'extrait de code ci-dessous, vous pouvez utiliser la commande " /help".

<strong>jshell> /help
|   Type a Java language expression, statement, or declaration.
|   Or type one of the following commands:
|   /list [<name or id>|-all|-start]
|     list the source you have typed
|   /edit <name or id>
|     edit a source entry referenced by name or id
|   /drop <name or id>
|     delete a source entry referenced by name or id
|   /save [-all|-history|-start] <file>
|     Save snippet source to a file.
|   /open <file>
|     open a file as source input
|   /vars [<name or id>|-all|-start]
|     list the declared variables and their values
|   /methods [<name or id>|-all|-start]
|     list the declared methods and their signatures
|   /types [<names or id>|-all|-start]
|     list the declared types
|   /imports
|     list the imported items
|   /exit
|     exit jshell
|   /env [-class-path <path> ] [-module-path <path>] [-add-modules <modules>] ...
|     view or change the evaluation context
|   /reset [-class-path <path>] [-module-path <path>] [-add-modules <modules>]...
|     reset jshell
|   /reload [-restore] [-quiet] [-class-path <path>] [-module-path <path>]...
|     reset and replay relevant history -- current or previous (-restore)
|   /history
|     history of what you have typed
|   /help [<command>|<subject>]
|     get information about jshell
|   /set editor|start|feedback|mode|prompt|truncation|format ...
|     set jshell configuration information
|   /? [<command>|<subject> ]
|     get information about jshell
|   /!
|     re-run last snippet
|   /
|     re-run snippet by id
|   /-
|     re-run n-th previous snippet
|   For more information type &#39;/help&#39; followed by the name of a command or a subject.
|   For example &#39;/help /list&#39; or &#39;/help intro&#39;.
|
|   Subjects:
|
|   intro
|     an introduction to the jshell tool
|   shortcuts
|     a description of keystrokes for snippet and command completion,
|     information access, and automatic code generation
|   context
|     the evaluation context options for /env /reload and /reset</strong>

JShell imprime différentes commandes internes existantes avec une introduction rapide à leur objectif et un accès à des instructions plus détaillées pour leur utilisation. Pour cela, il suffit de saisir la commande : "/help" puis de saisir le nom détaillé de la commande (par exemple, la commande "/set").

<strong>jshell> /help /set
|
|  /set
|
|   Set jshell configuration information, including:
|   the external editor to use, the start-up definitions to use, a new feedback mode,
|   the command prompt, the feedback mode to use, or the format of output.
|
|   /set editor [-wait] ...
|     Specify the command to launch for the /edit command.
|     The <command> is an operating system dependent string.
|
|   /set start <file>
|     The contents of the specified become the default start-up snippet s and commands.
|
|   /set feedback <mode>
|     Set the feedback mode describing displayed feedback for entered snippets and commands.
|
|   /set mode <mode>[<old-mode>] -command|-quiet|-delete
|     Create or update a user-defined feedback mode, optionally copying from an existing mode.
|
|   /set prompt <mode>"<prompt>" "<continuation-prompt>"
|     Set the displayed prompts for a given feedback mode.
|
|   /set truncation <mode> <length> <selector> ...
|     Set the maximum length of a displayed value.
|
|   /set format <mode> <field> "<format>" ...
|     Configure a feedback mode by setting the format of a field when the selector matches.
|
|   /set
|     Show editor, start, and feedback settings as /set commands.
|     To show the settings of any of the above, omit the set value.
|
|     To get more information about one of these forms, use /help with the form specified.
|  For example: /help /set format</strong>

Il faut retrouver la commande saisie dans la troisième partie, que ce soit pour modifier le retour de JShell (/set Feedback), pour modifier l'éditeur par défaut (/set editor), ou pour modifier le démarrage de JShell ( /set start).

<strong>jshell> /help /set feedback
| Set the feedback mode describing displayed feedback for entered snippets and
commands:
|
| /set feedback [-retain] <mode>
|
| Retain the current feedback mode for future sessions:
|
| /set feedback -retain
|
| Show the feedback mode and list available modes:
|
| /set feedback
|
| Where <mode> is the name of a previously defined feedback mode.
| You may use just enough letters to make it unique.
| User-defined modes can be added, see &#39;/help /set mode&#39;
|
| When the -retain option is used, the setting will be used in this and future
| runs of the jshell tool.
|
| The form without <mode> or -retain displays the current feedback mode and available modes.</strong>

Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!

Déclaration:
Cet article est reproduit dans:. en cas de violation, veuillez contacter admin@php.cn Supprimer