关于java:了解JVM Eclipse的运行情况

Find out what JVM Eclipse is running on

我目前正在尝试调整我的Eclipse安装并进入"-vm"选项。 SO上的其他帖子提到,总是使用最新的JVM是好的,因为它们在性能方面不断提高,所以我很可能会这样做。 我想知道如果你没有指定"-vm"参数,你怎么能找到JVM Eclipse运行的东西。

我在文档中找到了以下内容,但这并没有说明它将如何查找JVM:

when passed to the Eclipse executable, this option is used to locate the Java VM to use to run Eclipse. It must be the full file system path to an appropriate Java executable. If not specified, the Eclipse executable uses a search algorithm to locate a suitable VM. In any event, the executable then passes the path to the actual VM used to Java Main using the -vm argument. Java Main then stores this value in eclipse.vm.


实际上,Windows-> Preferences-> Java->安装并没有向您显示Eclipse运行的那个,而只显示它运行的默认JRE。

要查看正在运行的Eclipse,请转到帮助 - >关于Eclipse平台 - >配置详细信息,然后查找属性eclipse.vm。

例如:

1
eclipse.vm=C:\Program Files\Java\jre6\bin\client\jvm.dll


根据这个帖子和这一个:

eclipse将尝试通过检查您的路径来找到用于启动自身的JVM。

所以你可以:

  • Create a JAVA_HOME environment variable, that points to your actually preferred JDK.
    This way you can easily choose between JDKs installed.

  • Put %JAVA_HOME%\bin in the path, anywhere preceeding \system32, which also
    contains java, javaw & co binaries.
    This way the java* in the JDK bin directory is invoked whenever it is invoked from the path.

我相信其他帖子告诉你如何找到JVM eclipse正在使用的东西。

但是,我将您的问题解释为:"JVM将在启动时使用什么?"当没有使用-vm args时。

经过进一步的研究,看来eclipse会寻找一个JRE:

  • 直接在其安装目录(\jre)下:如果您复制该子目录中任何已安装的JRE的内容,它将被选中
  • C:\Program Files\Java\JRE...
  • %PATH%(见上文)

另外阅读这个SO答案,看看为什么eclipse默认选择jvm.dll而不是javaw.exe


如果您转到帮助 - >'关于Eclipse平台'并单击'配置详细信息'按钮,将需要一些时间来显示,但是您获得了eclipse配置的所有内容的转储...

我发现这两行是您正在寻找的:

-vm

C:\Program Files\Java\jdk1.6.0_10\bin..\jre\bin\client\jvm.dll


我想如果你这样做:
Window-> Preferences-> Java->已安装的JRE,您将在计算机上看到JRE列表。
检查的那个是eclipse正在使用的那个。

或者,如果您进入"运行配置"对话框并查看JRE选项卡,则可以选择要在其上运行的JRE。