jvm.cfg文件与Java相关的目的是什么?

eup*_*a83 9 java configuration

它有一些奇怪的关键字.请解释该文件的一般用途.

Rob*_*anu 14

精简版:

控制在调用java或javac时可以使用启动标志选取的JVM.

长版:

让我们从评论开始

# List of JVMs that can be used as an option to java, javac, etc.
# Order is important -- first in this list is the default JVM.
# NOTE that this both this file and its format are UNSUPPORTED and
# WILL GO AWAY in a future release.
Run Code Online (Sandbox Code Playgroud)

所以我们有一个'JVM'传递给java/javac的列表.我们需要澄清JVM在此文件的上下文中的含义.

我们来看一个简单的界限:

-green ERROR
Run Code Online (Sandbox Code Playgroud)

和实验

java -green > /dev/null
Error: green VM not supported
Run Code Online (Sandbox Code Playgroud)

因此,似乎ERROR标志表示不支持的配置.

让我们继续吧

-classic WARN
Run Code Online (Sandbox Code Playgroud)

并执行

java -classic > /dev/null
Warning: classic VM not supported; client VM will be used
Run Code Online (Sandbox Code Playgroud)

似乎'WARN'会将我们发送到默认的JVM,它似乎是我们的'客户'.

然后我们可以看一下第一行

-client IF_SERVER_CLASS -server
Run Code Online (Sandbox Code Playgroud)

这似乎表明默认值是服务器,除非机器是服务器类.

下一个是

-server KNOWN
Run Code Online (Sandbox Code Playgroud)

这意味着服务器JVM是已知的.

最后

-hotspot ALIASED_TO -client
Run Code Online (Sandbox Code Playgroud)

意味着热点等同于客户端.