• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Failed to load the JNI shared library

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

When I open eclipse I'm getting the following error message.

Failed to load the JNI shared library
...\OpenJDK\java-se-8u41-ri\bin..\jre\bin\client\jvm.dll

Then I click ok and it closes the window but does not open Eclipse.

My windows is 64 bit and Eclipse is 64 bit.

The OpenJDK I'm not sure if is 64 bit or 32.

When I run "java -version" on command prompt, when environment variables point to it, it does not say it is 64 bit, so I'm suspecting it is 32.
So that is the probable reason why Eclipse does not open.
Understand the JDK would also need to be 64 bit for it to work.

The interesting part is that JAVA_HOME and JRE_HOME are not pointing to this OpenJDK version.
They are point to another version that is also installed: \jdk1.8.0_191

And jdk1.8.0_191 is 64 bit.

So, I managed to solve this with the following steps:
1) Open System Environment variables
2) Change JAVA_HOME from ...\jdk1.8.0_191 to \OpenJDK\java-se-8u41-ri
3) Change JRE_HOME from ...\jdk1.8.0_191\bin to \OpenJDK\java-se-8u41-ri\bin
4) Open Eclipse again. It will still give the same error message as before.
5) Go back to environment variables and change them back to reference \jdk1.8.0_191 just as it was before
6) Open Eclipse. Now it works and the message disappears.

The problem is that every time I reboot my machine I need to do the same steps again.
Would like to know what can I do for Eclipse to stop with that message so that I don't need to be doing this process every time I reboot.
I'm not using the OpenJDK version anymore. Just the jdk1.8.0_191.

Thanks.
 
Marshal
Posts: 22453
121
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jf Okeeffe wrote:...\OpenJDK\java-se-8u41-ri\bin..\jre\bin\client\jvm.dll


That bin.. looks wrong. Assuming that the leading ... means the path is simply not displayed, and that the path up to OpenJDK is correct, it would probably work if the jvm.dll path was ...\OpenJDK\java-se-8u41-ri\bin\..\jre\bin\client\jvm.dll.

Can you open file eclipse.ini and show the value after -vm? It may be on a different line, but that doesn't matter. You can change the value to the correct JDK as well (I think you can use / instead of \ for improved readability). For reference, here's what my Eclipse says (it comes with a bundled jdk11 folder):
 
Saloon Keeper
Posts: 24314
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I didn't realize that OpenJDK was used on Windows. But I'm OK with the path, since a JDK would have a directory structure like this:



However, I think that there's something wrong elsewhere. Eclipse should NOT be using JAVA_HOME or JRE_HOME to locate its JVM. That, as Rob has pointed out, is done by the eclipse.ini file in the root directory for Eclipse itself.

I'm not sure that there is a 32-bit version of OpenJDK these days. OpenJDK comes after the general deprecation of 32-bit OS's (especially Linux, which bundles it with the OS).
 
Jf Okeeffe
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rob,

The leading ... I just placed here in the question.
In reality it's the local path. Let's say:
c:\java\OpenJDK\java-se-8u41-ri\bin..\jre\bin\client\jvm.dll

Here is the content of eclipse.ini.
-vm is not there.

-startup
plugins/org.eclipse.equinox.launcher_1.5.600.v20191014-2022.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.1100.v20190907-0426
-product
org.eclipse.epp.package.jee.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=1.8
-Dosgi.dataAreaRequiresExplicitInit=true
-Xms256m
-Xmx1024m
--add-modules=ALL-SYSTEM
 
Tim Holloway
Saloon Keeper
Posts: 24314
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Interestingly enough, the -vm entry isn't present in my copy of Eclipse either.

The Help/About menu brings up a dialog with an "Installation Details" button on it. Click it and select "Configuration" for the sub-dialog and look for "-vm" in there. Never mind that it's not in your eclipse.ini. It should be there.

Now interestingly, My copy of Eclipse says it's running under Java 8. That's NOT what my PATH or environment currently point to. I'm not sure where the information is being kept.

I've a strong suspicion that when you first install and run Eclipse, it finds the first eligible JVM on the PATH or via a filesystem search and uses that thereafter.
 
Jf Okeeffe
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is the -vm entry in Help/About>Installation Details > Configuration:

-vm
C:\Java\jdk1.8.0_191\bin\..\jre\bin\server\jvm.dll

So it is not pointing to the OpenJdk version.
That's somewhere else.
 
Tim Holloway
Saloon Keeper
Posts: 24314
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, that's a little strange, since I'd expect it to point to a formal executable like java.exe or javaw.exe, but Rob seems to work OK with something like that.

The noteworthy thing, though is that it appears that the error message is for a different version of Java than the one that the "-vm" parameter indicates.

Which would either imply that something's broken in Eclipse and you'd need to re-install it - OR the error isn't for Eclipse, but one of the projects IN Eclipse. Since Eclipse projects can each run with whatever version of Java that they want.

You might want to check your installed JDK list (Menu Window/Preferences, tab "Installed JREs" and see what's in there. Check to make sure that each installed JRE is, in fact installed on your machine. Also that they're located by ABSOLUTE filesystem paths, not relative paths!
 
Rob Spoor
Marshal
Posts: 22453
121
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Given that Eclipse doesn't start properly, I doubt it's a project setting. That would probably let Eclipse start, so you have the opportunity to fix it.

If the -vm option is missing you can simply add it. I've checked a second machine, and there it points to the bin folder of a different internal JVM:

It seems that using the jvm.dll file or the bin folder are both supported. Eclipse turns the bin folder into a jvm.dll path:

 
Jf Okeeffe
Ranch Hand
Posts: 64
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An update on this.

I found the issue.

After opening eclipse went to:

Project > JRE System Library > Right-click > Properties

The JRE was set to "Execution Environment".

After I changed it to "Alternate JRE" and fixed it to the correct version, the error stopped happening when opening Eclipse.
 
reply
    Bookmark Topic Watch Topic
  • New Topic