Mxyk
Mxyk

Reputation: 10698

Failed to load the JNI shared Library (JDK)

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 are a few points I'd like to make:

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?

Upvotes: 971

Views: 1617954

Answers (30)

Beachhouse
Beachhouse

Reputation: 5052

This happens because of the way the windows paths interact. Your 32-bit JRE is listed BEFORE your 64-bit version. Since javaw.exe is named the same for both 32 and 64 bit versions, it tries the first one it finds. Change the order in your Path Environmental variables, so the 64-bit version higher on the list than the 32-bit, and it will work correctly.

Upvotes: 0

jayesh kavathiya
jayesh kavathiya

Reputation: 3551

Make sure your eclipse.ini file includes the following lines.

-vm
C:\path\to\64bit\java\bin\javaw.exe

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.

Upvotes: 277

sjas
sjas

Reputation: 19767

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.)

In case you use a newer JDK and a older JRE you might be in for trouble, too, but then it is more likely a java.lang.UnsupportedClassVersionError appears, IIRC.

Upvotes: 322

Grim
Grim

Reputation: 2030

You need a 64-bit trio:

  • 64-bit OS
  • 64-bit Java
  • 64-bit Eclipse

Upvotes: 872

Beck Yang
Beck Yang

Reputation: 3024

I want to previde another solution for this error, especially for who want to use 32-bit and 64-bit Eclipse in one system.

Eclipse will startup using the JRE/JDK in jre sub-directory if it exists. (STS or other eclipse based IDE also support this feature...)

The solution is create directory junction using mklink.exe command which exist in windows vista or newer version (junction.exe offer similar function for Windows 2000/XP)
Open the command line windows and exeute following command:

mklink /j "$ECLIPSE-HOME/jre" "$JDK_or_JRE_home"

Of course, if the Eclipse is for 64-bit Windows, the architecture of JDK/JRE must be the same.

Assume:

  • Eclipse for windows x86_64 is installed in d:\devTool\eclipse
  • JDK for windows x64 is installed in C:\Program Files\Java\jdk1.8.0

The command for creating the jre folder will be:

mklink /j "d:\devTool\eclipse\jre" "C:\Program Files\Java\jdk1.8.0"

BTW, delete directory junction will NOT delete any file. If you create a wrong link, you can delete it using file explorer or rmdir command.

rmdir "d:\devTool\eclipse\jre"

Upvotes: 3

Kaka Hoang Huy
Kaka Hoang Huy

Reputation: 93

Installing JDK 1.8._91 (mixed mode) is another solution for this!

Upvotes: 0

vaquar khan
vaquar khan

Reputation: 11479

This error we are getting because of different Java version download 32-bit version.

Upvotes: 0

Peter Tseng
Peter Tseng

Reputation: 14003

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.

Upvotes: 46

sayannayas
sayannayas

Reputation: 774

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).

  1. 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.

  2. 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.ini file. If you don't, Eclipse will go crazy and try searching itself which is not good.

Upvotes: 7

Sreedhar GS
Sreedhar GS

Reputation: 2788

You have change proper version of the JAVA_HOME and PATH in environmental variables.

Upvotes: 3

Marcin Erbel
Marcin Erbel

Reputation: 1643

You should uninstall all old [JREs][1] and then install the newest one... I had the same problem and now I solve it. I've:

Better install Jre 6 32 bit. It really works.

Upvotes: 4

keesp
keesp

Reputation: 311

The easiest solution is to include a specific JRE in eclipse.ini:

wiki.eclipse.org/Eclipse.ini

With this, you can start almost any Eclipse version

Upvotes: 0

Federico Giorgi
Federico Giorgi

Reputation: 10755

In my case, I tried to launch java from the command prompt and got this error

Error: could not open "C:\Windows\jre\lib\amd64\jvm.cfg"

It meant "java" was looked for in the PATH starting at this wrong directory. Deleting the folder C:\Windows\jre\ solved the issue

Upvotes: 1

Guy Lowe
Guy Lowe

Reputation: 2370

I'm not sure why but I had the jre installed into my c:\windows directory and java.exe and javaw.exe inside my windows\system32 directory.

Obviously these directories were getting priority even AFTER adding the -vm flag to my eclipse.ini file.

Delete them from here fixed the issue for me.

Upvotes: 2

Niranga
Niranga

Reputation: 778

I had the same problem. with 64bit os all should be 64bit. Java and Eclipse. I tried all the methods in stackoverflow and also in youtube. non of them worked for me untill i found this easy method.

I installed 64bit java form Cnet download and the problem was automatically fixed. I mentioned the source because it is too easy to google and go to first Cnet lint rather than oficial site if you are a new bee.

p.s. if you have Android ADT bundle and tried to open eclipse from it and got the same error, you can fix that problem too with this method.

Upvotes: 0

Rolf
Rolf

Reputation: 381

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

Upvotes: 3

felipe.zkn
felipe.zkn

Reputation: 2060

The same occurred to me. I had 64-bit Eclipse, but my JDK was 32-bit. So I installed the 64-bit version and it's OK right now.

Upvotes: 2

Supun Sameera
Supun Sameera

Reputation: 2703

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. :)

Upvotes: 3

Stalin Gino
Stalin Gino

Reputation: 622

For a missing jvm.dll file, we can provide the path of the dll file in eclipse.ini file as

-vm
C:\Progra~1\Java\jdk1.6.0_38\jre\bin\server\jvm.dll

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.

Upvotes: 18

rootpd
rootpd

Reputation: 317

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:

  1. Find the jvm.dll in your JRE directory: C:\Program Files\Java\jre7\server\bin\jvm.dll

  2. Find the jvm.dll in your JDK directory: c:\Program Files\Java\jdk1.7.0_xx\jre\bin\server\

  3. Copy the jvm.dll from 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.

Upvotes: 2

sadegh saati
sadegh saati

Reputation: 1170

I have experienced all of the Eclipse errors and this is one of them. The problem is Eclipse 64-bit version. Download the 32-bit version and launch it.

Upvotes: -1

PushkarHJoshi
PushkarHJoshi

Reputation: 19

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..

Upvotes: 3

cloakedninjas
cloakedninjas

Reputation: 4206

And for PDT users - avoid the Zend download page - it doesn't have any 64-bit downloads linked.

Use the Elipse site itself.

The above link had an older 3.6 Eclipse which then failed to update itself due to Eclipse Bug #317785.

My solution was to just install 32-bit Java alongside 64-bit - this allowed the Zend installer to work.

It's depressing that amount of Java / Eclipse cruft one has to go through to get a PHP IDE.

Upvotes: 1

user1600401
user1600401

Reputation: 37

Just check the PATH environment variable. In My Computer - > Properties -> Advanced System settings -> Environment Variables -> (left upper window "User Variables for "some name of PC"" ) just check the PATH variable. If it doesn't exist create it with the following -- > C:\Program Files (x86)\Java\jre7\bin <--

I was faced with the same problem after had updated my Eclipse. I've found that the path asked 64-bit version, but I had the 32-bit in dif path. It was helpful for me. P.S.: I have a 64-bit OS, 32-bit JRE and 32-bit Eclipse. All works fine :)

Upvotes: 4

Rahul Raghuvanshi
Rahul Raghuvanshi

Reputation: 56

You can install the 32-bit version of JDK on a 64-bit machine. See JDK 7 downloads.

Upvotes: 1

spannow
spannow

Reputation: 131

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.)

Upvotes: 32

Ignacio
Ignacio

Reputation: 71

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.

Upvotes: 6

Jeena
Jeena

Reputation: 309

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.

Upvotes: 4

Deepak Tyagi
Deepak Tyagi

Reputation: 31

Sure, you need to have a compatible version of JDK and Eclipse, but you also need to add in the eclipse.ini file the below lines:

-vm
yourdrive\java\bin

Make them the first two lines of your eclipse.ini file.

Upvotes: 10

Mike Starov
Mike Starov

Reputation: 7316

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.

Upvotes: 5

Related Questions