java - tool - mat failed to load jni shared library
Failed to load the JNI shared Library(JDK) (20)
Working pairings of OS, JDK and Eclipse:
- 32-bit OS - 32-bit JDK - 32-bit Eclipse (32-bit only)
- 64-bit OS - 32-bit JDK - 32-bit Eclipse
- 64-bit OS - 64-bit JDK - 64bit Eclipse (64-bit only)
I had several JDKs and JREs installed.
Each of them had their own entry in the PATH variable, all was working more or less.
Judging from the PATH variables, some installations were completely useless, since they were never used. Of course, the "inactive" Javas could be referenced manually from within Eclipse if I needed, but I never did that, so I really did not need them. (At least I thought so at that time...)
I cleaned up the mess, deinstalled all current Java's, installed only JDK + JRE 1.7 64-bit.
One of the Eclipse 'installations' failed afterwards with the
Failed to Load the JNI shared Library and a given path relative to the fresh installed JDK where it thought the
jvm.dll to be.
The failing Eclipse was the only one of all my IDEs that was still a 32-bit version on my otherwise all-64-bit setup.
Adding VM arguments, like so often mentioned, in the
eclipse.ini was no use in my case (because I had only the wrong JDK/JRE to relate to.)
I was also unable to find out how to check if this Eclipse was a 32-bit or 64-bit version (I could not look it up in the Task Manager, since this Eclipse 'installation' would not start up. And since it had been a while since I had set it up, I could not remember its version either.)
When I try opening Eclipse, a pop-up dialog states:
Failed to load the JNI shared library "C:/JDK/bin/client/jvm.dll"`.
Following this, Eclipse force closes.
Here's a few points I'd like to make:
- I checked to see if anything exists at that path. It does exist.
- My Eclipse and Java SE Development Kit are both 64-bit. I checked my system, and it can handle 64-bit.
- I've searched for this problem on Google and on Stack Overflow, and the only answer I found was to download the 32-bit versions of JDK and Eclipse.
Downloading the 32-bit versions is something I only want to do as a very last resort.
What would be suggested to solve this issue?
Alternatively, get the same "bit" version of JRE and Eclipse and then create a new shortcut with the below target (replace the installed JRE and Eclipse location/path):
"C:\studio\eclipse.exe" -vm "C:\Program Files\Java\jre7\bin\server\jvm.dll" eclipse.vm="C:\Program Files\Java\jre7\bin\server\jvm.dll" java.home="C:\Program Files\Java\jre7" java.runtime.version=1.7.0
That should do the trick.
Another option is:
Create a shortcut to the Eclipse.exe. Open the shortcut and change the target to:
"C:\Program Files\eclipse\eclipse.exe" -vm "c:\Program Files\Java\jdk1.7.0_04\bin\javaw.exe"
For your installation, make sure the locations point to the correct Eclipse installation directory and the correct
javaw.exe installation directory.
(The 64/32 bit versions of Eclipse and Java need to be the same, of course.)
As many folks already alluded to, this is a 32 vs. 64 bit problem for both Eclipse and Java. You cannot mix up 32 and 64 bit. Since Eclipse doesn't use
JAVA_HOME, you'll likely have to alter your PATH prior to launching Eclipse to ensure you are using not only the appropriate version of Java, but also if 32 or 64 bit (or modify the INI file as Jayath noted).
If you are installing Eclipse from a company-share, you should ensure you can tell which Eclipse version you are unzipping, and unzip to the appropriate Program Files directory to help keep track of which is which, then change the PATH (either permanently via (Windows) Control Panel -> System or set
PATH=/path/to/32 or 64bit/java/bin;%PATH% (maybe create a batch file if you don't want to set it in your system and/or user environment variables). Remember, 32-bit is in Program files (x86).
If unsure, just launch Eclipse, if you get the error, change your PATH to the other 'bit' version of Java, and then try again. Then move the Eclipse directory to the appropriate Program Files directory.
For a missing
jvm.dll file, we can provide the path of the dll file in
eclipse.ini file as
Here it is important to remove any space in the path and the double quotes. It worked for me when i removed the quotes and space.
I hope it helps someone.
I had a similar problem. It was solved doing the following.
- Move Eclipse to Program Files (not to Program Files (x86)).
- Remove the path to the 32-bit version of Java from the 'path' environment variable.
I have both versions of Java installed, but Eclipse kept trying to use the 32-bit one.
I had the same issue after upgrading from Java 6 to Java 7. After I removed Java 6 (64 bit) and reinstalled Java 7 (64 bit), Eclipse worked. :)
I have multiple versions of Java installed, both Sun JDK & JRockit, both 32 bit and 64-bit, etc. and ran into this problem with a fresh install of 64-bit Eclipse for Java EE (JUNO).
What did NOT work:
64-bit trio as suggested by Peter Rader:
I'm using 64-bit Eclipse on 64-bit OS (Windows 7).
I ensured Sun JDK 7 64-bit was the default java version. When I typed "java -version" from command line (cmd.exe), Sun JDK 7 64-bit was returned...
java version "1.7.0" Java(TM) SE Runtime Environment (build 1.7.0-b147) Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
This did not resolve the problem for me.
What DID work:
Adding -vm option to eclipse.ini as suggested by Jayesh Kavathiya:
I added the following to eclipse.ini:
I did not have to uninstall any of the various versions of JDK or JRE I have on my machine.
If you use whole 64-bit trio and it still doesn't work (I've come to this problem while launching Android Monitor in Intellij Idea), probably wrong jvm.dll is being used opposed to what your java expects. Just follow these steps:
Find the jvm.dll in your JRE directory:
Find the jvm.dll in your JDK directory:
jvm.dllfrom JRE drectory into your JDK directory and overwrite the jvm.dll in JDK.
Don't forget to make a backup, just in case. No need to install or uninstall anything related to Java.
It is crucial to add the -vm parameter and its value on 2 lines AT THE BEGINNING of the eclipse.ini
-vm C:\Program Files\Java\jdk1.7.0_45\bin\javaw.exe
Make sure you are starting Eclipse with Administrator rights.
Make sure your eclipse.ini file includes the following lines.
My eclipse.ini for example:
-startup plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.2.R36x_v20101222 -product org.eclipse.epp.package.java.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform -vm C:\Program Files\Java\jdk1.6.0_32\bin\javaw.exe --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vmargs -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx512m
Use OS and Eclipse both 64 bit or both 32 bit keep same and config eclipse.ini.
Your eclipse.ini file can be found in your eclipse folder.
One of the easy ways to resolve it is to copy the
jre folder from installed the JDK into the Eclipse installation folder. Make sure that JDK you copy from is the same architecture as your Eclipse installation.
I had to configure my machine that way, because I run both Eclipse and Appcelerator Titanium Studio on my machine. The Studio needs 32-bit Java, while Eclipse needs 64-bit.
Simple, I have a 64-bit OS, 32-bit Eclipse and both JDK 32 & 64 installed... I just uninstalled the 64-bit JDK and Eclipse is working fine..
Thank you misterfrb, I realised that Eclipse was giving this error, because I had just installed Oracle 10g Developer suite, and it was looking for the
jvm.dll file in the
C:\DevSuiteHome_1 folder (I must have opted to install JDK again along with developer suite).
After removing the DevSuiteHome lines from the paths variable and adding the correction location for 64-bit
jvm.dll (not sure if this was necessary, didn't try without), Eclipse worked again, and Developer suite still does too.
The answers above me got me tempted so much, that I decided to dry run all the possible combinations with OS, Eclipse and JVM trio. Anyway, whoever is digging down and reading my post, check the following as a hot spot (I am Windows 7 user).
You understand Program Files and Program File (x86) are two different folders... x86 stands for the 32-bit version of programs and the former is the 64-bit version.
If you have multiple versions of Java installed with different bitness and release versions, which is bound to happen with so many open source IDEs, managers, administrative consoles, the best option is to set the VM argument directly in the
eclipse.inifile. If you don't, Eclipse will go crazy and try searching itself which is not good.
This error means that the architecture of Eclipse does not match the architecture of the Java runtime, i.e. if one is 32-bit the other must be the same, and not 64-bit.
The most reliable fix is to specify the JVM location in eclipse.ini:
-vm C:\Program Files (x86)\Java\jdk1.7.0_55\bin\javaw.exe
Important: These two lines must come before -vmargs. Do not use quotes; spaces are allowed.
Yes, just make sure your versions of Eclipse and JDK are both 64-bit. Just to make sure everything is correct uninstalled JDK and install it in Program Files and not in Program Files (x86). At least that resolved my problem.
You can solve that problem as many other replicated. You need that Eclipse and the JDK be 32-bits or both on 64-bits. The architecture of the OS doesn't matter while the others remains on the same type of arquitecture.
You need a 64-bit trio:
- 64-bit OS
- 64-bit Java
- 64-bit Eclipse