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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1190360/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 00:41:52  来源:igfitidea点击:

What is the purpose of jvm.cfg file in relation to Java?

javaconfiguration

提问by euphoria83

It has some strange keywords. Please explain the general purpose of the file.

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

采纳答案by Robert Munteanu

Short version:

精简版:

Controls the JVMs which may be picked with startup flags when invoking java or javac.

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

Long version:

长版:

Let's start with the comments

让我们从评论开始

# 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.

So we have a list of 'JVM's to pass to java/javac. We need to clarify what a JVM is in the context of this file.

所以我们有一个“JVM”列表要传递给java/javac。我们需要在这个文件的上下文中阐明 JVM 是什么。

Let's take one simple line:

让我们看一条简单的线:

-green ERROR

and experiment

和实验

java -green > /dev/null
Error: green VM not supported

So it seems that the ERROR flag signals an unsupported configuration.

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

Let's move on to

让我们继续

-classic WARN

and execute

并执行

java -classic > /dev/null
Warning: classic VM not supported; client VM will be used

Seems that 'WARN' will send us to the default JVM which seems to be 'client' for us.

似乎“警告”会将我们发送到默认的 JVM,这对我们来说似乎是“客户端”。

Then we can take a look at the first line

然后我们可以看看第一行

-client IF_SERVER_CLASS -server

which seems to signal that the default is server unlessthe machine is a server-class.

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

The next one is

下一个是

-server KNOWN

which means that the server JVM is known.

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

And finally

最后

-hotspot ALIASED_TO -client

means that hotspot is equivalent to client.

意味着热点相当于客户端。