Monday, February 4, 2013

Eclipse Error : Failed to load JNI shared library



You are facing this error means eclipse is not able to locate the jvm.dll so check the <Java installation dir>/jdkxxx/jre/bin/server/jvm.dll path is proper or not. Also check the Java path settings.
 If you google for it, then you can get some solutions but they are confusing and might not work for all machines. 

But in the most cases you can face this problem if your eclipse is 32 bit and you have installed a 64 bit Java. I have many applications which required a 64 bit Java so I upgraded it from 32 to 64 bit without knowing that my eclipse is 32 bit. So I got this error. Now you can't change the Java path for 32 bit Java, because other applications are using 64 bit Java.

Solution:

Step 1:
Install both 32 bit and 64 bit Java . Set the environment varibale path for 64 bit Java So that all other applications can use it. Now right click on the eclipse shortcut icon and click Properties In the Target text field add the jvm.dll location with the -vm arg. So It should look like this :

Target:
"D:\eclipse_indigo\eclipse\eclipse2.exe" -vm "C:\eclipseJava7\jdk1.7.0_13\jre\bin\server\jvm.dll"

Step 2:
Now click Open file location and edit the eclipse.ini file with the same -vm arg and its value. Given below is my eclipse.ini
-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
1024m
--launcher.defaultAction
openFile
-vm
C:\eclipseJava7\jdk1.7.0_13\jre\bin\server\jvm.dll
-vmargs
-Xms512m
-Xmx1024m

So now your eclipse will use the 32 bit Java and all other applications will use 64 bit java as it is set as the Java path.  

No comments:

Post a Comment