43

I'm currently trying to tune my Eclipse installation and bumped into the "-vm" option. 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. I was wondering though how you could find out what JVM Eclipse runs on if you are not specifying the "-vm" parameter.

I found the following in the docs but that doesn't clarify how it will look for a 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.

Christophe Herreman
  • 15,366
  • 7
  • 55
  • 86
  • 1
    The solution chosen tells you what JVM eclipse ends up running with. It does not tell you anything about **why** that JVM has been selected, meaning: nothing about that "search algorithm to locate a suitable VM" – VonC Feb 17 '09 at 15:24
  • I was looking for the JVM Eclipse was running on. I agree that my question was perhaps not that clear because I mentioned the part from the docs. Thanks for your answer though. – Christophe Herreman Feb 17 '09 at 15:29
  • No problem. Actually my interpretation of your question has been much more interesting to me than just pointing to "eclipse.vm" configuration panel ;) – VonC Feb 17 '09 at 15:37

4 Answers4

74

Actually, Windows->Preferences->Java->installed doesn't show you the one Eclipse runs under, but only the default JRE that it runs things under.

To see the one Eclipse is runing under, go to Help->About Eclipse Platform->Configuration Details, and look for the property eclipse.vm.

For example:

eclipse.vm=C:\Program Files\Java\jre6\bin\client\jvm.dll
MWiesner
  • 7,913
  • 11
  • 31
  • 66
Don Branson
  • 13,237
  • 10
  • 54
  • 98
11

According to this thread and this one:

eclipse will try to locate your JVM used for launching itself by examining your path.

So, you can:

  • 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 <windowsroot>\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.

I believe the other posts tell you how to find what JVM eclipse is using.

However, I interpreted your question as: "what JVM will eclipse will use when launching itself ?" when no -vm args is used.


After further research, it appears that eclipse will look for a 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
  • in C:\Program Files\Java\JRE....
  • in the %PATH% (see above)

Also read this SO answer to see why eclipse will by default select jvm.dll instead of javaw.exe

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • Thanks for the info. It is somehow strange though. I have a JAVA_HOME env. var. which points to C:\Program Files\Java\jdk1.6.0_07 but Eclipse seems to be running on C:\Program Files\Java\jre6\bin\client\jvm.dll. – Christophe Herreman Feb 17 '09 at 15:24
7

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

I found these 2 lines to be what you're looking for:

-vm

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

miller
  • 1,352
  • 3
  • 21
  • 49
Akrikos
  • 3,354
  • 2
  • 20
  • 20
-2

I think if you do:
Window->Preferences->Java->Installed JREs
you'll see a list of JREs on your machine. The one that's checked is the one that eclipse is using.

Alternatively, if you go into the "run configurations" dialog, and look at the JRE tab, you can pick a JRE to run on there.

dw.mackie
  • 2,015
  • 1
  • 17
  • 18