jshell中的J和R标志的确切含义/目的是什么? [英] What is the exact meaning / purpose of the J and R flags in jshell?

查看:173
本文介绍了jshell中的J和R标志的确切含义/目的是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从帮助信息中:

-J<flag>              Pass <flag> directly to the runtime system.
                      Use one -J for each runtime flag or flag argument
-R<flag>              Pass <flag> to the remote runtime system.
                      Use one -R for each remote flag or flag argument

工具文档 jshell用户指南.

另外,在jshell上下文中,远程运行时系统"是什么?

Also, what is "the remote runtime system" in the context of jshell?

推荐答案

据我了解,JShell有3个主要的地方"来执行代码:

As I understand it, JShell has 3 main 'places' to execute code:

在与JShell客户端相同的JVM中(请参见 LocalExecutionControl )

In the same JVM as the JShell client (see LocalExecutionControl)

在远程代理上(请参见 JdiDefaultExecutionControl )

On the remote agent (see JdiDefaultExecutionControl)

使用jshell工具,启动前我们没有 current 进程,因此我们只有两个选择-使用一个JVM(本地)或使用两个JVM-一个用于JShell客户端(本地)另一个用于执行引擎(可能是远程的).

Using jshell tool, we have no current process before launch, so we have only two options - use one JVM (locally), or use two JVMs - one for JShell client (locally) and another for the execution engine (possibly remotely).

有趣的是,默认情况下,JShell总是启动两个JVM,因为硬编码的-execution 键为"failover:0(jdi:hostname(" + loopback + ")),1(jdi:launch(true)), 2(jdi)"(请参阅

The interesting thing is, JShell always launch two JVMs by default, as the hard-coded --execution key is "failover:0(jdi:hostname(" + loopback + ")),1(jdi:launch(true)), 2(jdi)" (see JShell class source code).

更接近重点.我已经使用-verbose选项进行了一些实验,并在运行时使用ManagementFactory.getRuntimeMXBean().getInputArguments()检查了JVM选项.

Closer to the point. I've made a couple of experiments with -verbose option and checked JVM options in runtime with ManagementFactory.getRuntimeMXBean().getInputArguments().

  • jshell -J-verbose命令

在控制台中打印的-verbose输出.

Printed -verbose output in the console.

-verbose选项:[-agentlib:jdwp=transport=dt_socket,address=127.0.0.1:63305]

jshell -R-verbose命令

控制台中没有-verbose输出.

Printed -verbose选项:[-agentlib:jdwp=transport=dt_socket,address=127.0.0.1:63339, -verbose]

Printed -verbose option in the input arguments: [-agentlib:jdwp=transport=dt_socket,address=127.0.0.1:63339, -verbose]

jshell --execution="local" -J-verbose命令

在控制台中打印的-verbose输出.

Printed -verbose output in the console.

Printed -verbose选项:[-Dapplication.home=C:\Program Files\Java\jdk-9, -Xms8m, -verbose, -Djdk.module.main=jdk.jshell]

Printed -verbose option in the input arguments: [-Dapplication.home=C:\Program Files\Java\jdk-9, -Xms8m, -verbose, -Djdk.module.main=jdk.jshell]

jshell --execution="local" -R-verbose

控制台中没有-verbose输出.

-verbose选项:[-Dapplication.home=C:\Program Files\Java\jdk-9, -Xms8m, -Djdk.module.main=jdk.jshell]

-J<flag>将选项传递给 JShell客户端 JVM

-J<flag> passes option to the JShell client JVM

-R<flag>将选项传递给执行引擎 JVM

-R<flag> passes option to the execution engine JVM

-J<flag>将选项传递给仅存在 JVM

-J<flag> passes option to the only present JVM

-R<flag>什么都不做

这篇关于jshell中的J和R标志的确切含义/目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆