Review Request : JDK-8213362 : Could not find libjava.dylib error when initializing JVM via JNI_CreateJavaVM

Priyanka Mangal priyanka.mangal at
Tue Nov 6 04:35:49 UTC 2018

The Eclipse launcher is capable of loading the Java VM in the eclipse 
process using the Java Native Interface Invocation API.  The launcher is 
still capable of starting the Java VM in a separate process the same as 
previous version of Eclipse did.  Which method is used depends on how 
the VM was found.

        No -vm specified

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 the launcher looks for a jvm 
shared library (jvm.dll on Windows, on *nix platforms) 
relative to that java executable.

  * If a jvm shared library is found the launcher loads it and uses the
    JNI invocation API to start the vm.
  * If no jvm shared library is found, the launcher executes the java
    launcher to start the vm in a new process.

        -vm specified on the command line or in eclipse.ini

Eclipse can be started with "-vm <location>" to indicate a virtual 
machine to use. There are several possibilities for the value of <location>:

 1. directory:  <location> is a directory. We look in that directory
    for: (1) a java launcher or (2) the jvm shared library. If we find
    the jvm shared library, we use JNI invocation. If we find a
    launcher, we attempt to find a jvm library in known locations
    relative to the launcher. If we find one, we use JNI invocation. If
    no jvm library is found, we exec java in a new process.
 2. java.exe/javaw.exe: <location> is a path to a java launcher. We exec
    that java launcher to start the vm in a new process.
 3. jvm dll or so: <location> is a path to a jvm shared library. We
    attempt to load that library and use the JNI Invocation API to start
    the vm in the current process.

Found from
On 11/5/2018 8:24 PM, Alan Bateman wrote:
> On 05/11/2018 14:21, Magnus Ihse Bursie wrote:
>> Hi,
>> Fix looks good, but maybe we should have a regression test of 
>> GetJREPath()?
>> /Magnus
> The fix looks okay but I'm puzzled as to how Eclipse is running into 
> this. Do they locate/call libjli/GetJREPath directly or is this 
> happening then it is called indirectly?
> -Alan

More information about the build-dev mailing list