简体   繁体   English

了解JVM Eclipse的运行情况

[英]Find out what JVM Eclipse is running on

I'm currently trying to tune my Eclipse installation and bumped into the "-vm" option. 我目前正在尝试调整我的Eclipse安装并进入“-vm”选项。 Other posts on SO mentioned that it's good to always use the latest JVM available because they keep getting better in terms of performance, so I'm likely to do that. SO上的其他帖子提到,总是使用最新的JVM是好的,因为它们在性能方面不断提高,所以我很可能会这样做。 I was wondering though how you could find out what JVM Eclipse runs on if you are not specifying the "-vm" parameter. 我想知道如果你没有指定“-vm”参数,你怎么能找到JVM Eclipse运行的东西。

I found the following in the docs but that doesn't clarify how it will look for a JVM: 我在文档中找到了以下内容,但这并没有说明它将如何查找JVM:

when passed to the Eclipse executable, this option is used to locate the Java VM to use to run Eclipse. 传递给Eclipse可执行文件时,此选项用于查找用于运行Eclipse的Java VM。 It must be the full file system path to an appropriate Java executable. 它必须是适当Java可执行文件的完整文件系统路径。 If not specified, the Eclipse executable uses a search algorithm to locate a suitable VM . 如果未指定,Eclipse可执行文件使用搜索算法来查找合适的VM In any event, the executable then passes the path to the actual VM used to Java Main using the -vm argument. 无论如何,可执行文件然后使用-vm参数将路径传递给用于Java Main的实际VM。 Java Main then stores this value in eclipse.vm. 然后,Java Main将此值存储在eclipse.vm中。

Actually, Windows->Preferences->Java->installed doesn't show you the one Eclipse runs under, but only the default JRE that it runs things under. 实际上,Windows-> Preferences-> Java->安装并没有向您显示Eclipse运行的那个,而只显示它运行的默认JRE。

To see the one Eclipse is runing under, go to Help->About Eclipse Platform->Configuration Details, and look for the property eclipse.vm. 要查看正在运行的Eclipse,请转到帮助 - >关于Eclipse平台 - >配置详细信息,然后查找属性eclipse.vm。

For example: 例如:

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

According to this thread and this one : 根据这个帖子这一个

eclipse will try to locate your JVM used for launching itself by examining your path. eclipse将尝试通过检查您的路径来找到用于启动自身 JVM

So, you can: 所以你可以:

  • Create a JAVA_HOME environment variable, that points to your actually preferred JDK. 创建一个JAVA_HOME环境变量,指向您实际首选的JDK。
    This way you can easily choose between JDKs installed. 这样您就可以轻松地在安装的JDK之间进行选择。

  • Put %JAVA_HOME%\\bin in the path, anywhere preceeding <windowsroot>\\system32 , which also contains java, javaw & co binaries. 将%JAVA_HOME%\\ bin放在路径中,在<windowsroot>\\system32任何位置,其中还包含java,javaw和co二进制文件。
    This way the java* in the JDK bin directory is invoked whenever it is invoked from the path. 这样,只要从路径调用JDK bin目录中的java *,就会调用它。

I believe the other posts tell you how to find what JVM eclipse is using. 我相信其他帖子告诉你如何找到JVM eclipse正在使用的东西。

However, I interpreted your question as: "what JVM will eclipse will use when launching itself ?" 但是,我将您的问题解释为:“JVM将在启动时使用什么?” when no -vm args is used . 当没有使用-vm args时


After further research, it appears that eclipse will look for a JRE: 经过进一步的研究,看来eclipse会寻找一个JRE:

  • either directly under its installation directory ( <eclipse>\\jre ): if you copy the content of any installed JRE in that sub-directory, it will be selected 直接在其安装目录下( <eclipse>\\jre ):如果您复制该子目录中任何已安装的JRE的内容,它将被选中
  • in C:\\Program Files\\Java\\JRE... . C:\\Program Files\\Java\\JRE...
  • in the %PATH% (see above) %PATH% (见上文)

Also read this SO answer to see why eclipse will by default select jvm.dll instead of javaw.exe 另外阅读这个SO答案 ,看看为什么eclipse默认选择jvm.dll而不是javaw.exe

If you go to Help->'About Eclipse Platform' and click on the 'Configuration Details' button it will take a moment to display, but you get a dump of everything eclipse is configured for... 如果您转到帮助 - >'关于Eclipse平台'并单击'配置详细信息'按钮,将需要一些时间来显示,但是您获得了eclipse配置的所有内容的转储...

I found these 2 lines to be what you're looking for: 我发现这两行是您正在寻找的:

-vm -vm

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

I think if you do: 我想如果你这样做:
Window->Preferences->Java->Installed JREs Window-> Preferences-> Java-> Installed JREs
you'll see a list of JREs on your machine. 你会在你的机器上看到一个JRE列表。 The one that's checked is the one that eclipse is using. 检查的那个是eclipse正在使用的那个。

Alternatively, if you go into the "run configurations" dialog, and look at the JRE tab, you can pick a JRE to run on there. 或者,如果您进入“运行配置”对话框并查看JRE选项卡,则可以选择要在其上运行的JRE。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM