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.
java.exe is the command where it waits for application to complete untill it takes the next command. javaw.exe is the command which will not wait for the application to complete. you can go ahead with another commands. Save this answer.
jvm. dll is the actual Windows implementation of the JVM (or better, the main entry point). C or C++ applications can use this DLL to run an embedded Java runtime, and that would allow the application to interface directly with the JVM, e.g. if they want to use Java for its GUI.
JIT is VM's prerogative, java.exe is not JVM, strictly speaking. It just launches it and feeds it with the code. By that logic, java.exe doesn't even feed the JVM code, that is done by the ClassLoader which is part of the JVM.
Regardless of your operating system, you will need to install some Java virtual machine (JVM). You may either install a Java Runtime Environment (JRE), or a Java Development Kit (JDK), depending on what you want to do with Eclipse. If you intend to use Eclipse for Java development, then you should install a JDK.
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.
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:
The javaw.exe will be the sub-process (child process) of the eclipse.exe process.
So the choice is up to you.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With