Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between running Eclipse on jvm.dll and java.exe (or javaw.exe)

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.

like image 435
informatik01 Avatar asked May 23 '15 18:05

informatik01


People also ask

What is difference between java exe and Javaw exe?

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.

What is the use of JVM DLL?

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.

Is java exe JVM?

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.

What is JVM Eclipse?

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.


1 Answers

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

like image 104
informatik01 Avatar answered Sep 30 '22 12:09

informatik01