7

What is the difference between using jvm.dll and java.exe as the JVM for Eclipse to run on?


DISCLAIMER
I have posted this question along with the answer because I find this information useful and want to share this with others.

1 Answer 1

6

How Eclipse is launched when no -vm is specified

OK, just to resolve a confusion: fresh installation of Eclipse on Windows has no -vm configuration specified in the eclipse.ini file.

Let's see what the official Equinox Launcher documentation says about situation when no -vm is specified (emphasis mine):

When no -vm is specified, the launcher looks for a virtual machine first in a JRE directory in the root of eclipse and then on the search path. If Java is found in either location, then we look for a JVM shared library (jvm.dll on Window, libjvm.so on *nix platforms) relative to that Java executable.

  • If a JVM shared library is found we load it and use the JNI invocation API to start the vm
  • If no JVM shared library is found, we exec the Java launcher to start the vm in a new process

So as you can see, the jvm.dll is the one that is searched for in the first place, and ONLY if it is not found, THEN the Java launcher (i.e. java.exe or javaw.exe) is used.


Difference between using jvm.dll and javaw.exe (or java.exe)

  • When using jvm.dll Eclipse uses the JNI Invocation API to start the vm in the current process. You will see only ONE process in the task manager:
    eclipse.exe

  • When using javaw.exe (or java.exe) Eclipse executes that Java Launcher to start the vm in a new process. You will see TWO processes in the task manager:

  1. eclipse.exe
  2. javaw.exe (or java.exe if it was configured)

The javaw.exe will be the sub-process (child process) of the eclipse.exe process.

So the choice is up to you.


Other thoughts

One of the most recommended options to use is to specify a specific JVM for Eclipse to run on. Doing this ensures that you are absolutely certain which JVM Eclipse will run in and insulates you from system changes that can alter the "default" JVM for your system. Read more here: Specifying the JVM

Not the answer you're looking for? Browse other questions tagged or ask your own question.