Solved - Failed to load the JNI shared Library - JDK - eclipse

You are here : Home / Core Java Tutorials /


In this tutorial we will solve - Failed to load the JNI shared Library.


You might have face many issues like - Failed to load the JNI shared Library jvm.dll



ACTUAL PROBLEM IN Failed to load the JNI shared Library IS>
The architecture of Eclipse is not matching with the architecture of the JVM.
Either of them must be in 32 or 64 bit.


SOLUTION 1 >
You must ensure that you have following installed on your system >
  • 64 bit Operating system
  • 64 bit Java version
  • 64 bit Eclipse version


Or each and every one must be in 32 bit version.

SOLUTION 2 >
Or another solution is to define vm argument in eclipse.ini (located in root folder of eclipse installation folder) and specify javaw.exe path
Example > Add


-vm
C:\Program Files\Java\jdk1.7.0_51\bin\javaw.exe


Add above lines just Before -vmargs.



If any of the above following is in 32 or 64 bit version than you might face Failed to load the JNI shared Library.


Also read :
  • how to find out the java version (32 bit or 64 bit) installed in your system.


Now, Let’s see how to find out OS, Java and eclipse version installed in your system/windows >


How to find out Java version installed in your system/windows >
  1. You may use this java program to find Java version installed in your system/windows >


if 32 bit java version is installed than (System.getProperty("sun.arch.data.model")) returns 32


if 64 bit java version is installed than (System.getProperty("sun.arch.data.model")) returns 64


/** Find current JVM version (32 bit java version or 64 bit java version ?) */
public class FindCurrentJavaVersionExample {
   public static void main(String[] args) {
          String currentJavaVersion = System.getProperty("sun.arch.data.model");
          System.out.println("current Java Version on system = "+
                       currentJavaVersion);
   }
}
/*OUTPUT
current Java Version on system = 64
*/


output of program may vary on different systems, mines system have 64 bit java version installed


  1. You may use this CMD command to find Java version installed in your system/windows >
Java -version
But before using this command you must set JAVA_HOME and PATH.


  1. You may use this following CMD commands as well to find Java version installed in your system/windows > >
Java -d32
If system has 64 JVM installed then error message will be > This Java instance does not support a 32-bit JVM
Java -d64
If system has 32 JVM installed then error message will be > This Java instance does not support a 64-bit JVM


How to find out window version installed in your system/windows >
  1. You may use this java program to find windows version installed in your system >
I have installed AMD64 >which  is also known as  x64 and x86-64, so AMD64 is the 64-bit version of the windows.
/** Find current Operating System version (OS)  (32 bit version or 64 bit version window ?) */
public class FindCurrentOperatingSystemVesrionExample {
   public static void main(String[] args) {
          String currentOperatingSystemVersion = System.getProperty("os.arch");
          System.out.println("current (OS) Operating System Version = "+
                    currentOperatingSystemVersion);  //AMD64 is 64-bit version of windows
   }
}

/*OUTPUT
current (OS) Operating System Version = amd64
*/
Output of program may vary on different systems.


  1. You may use this CMD command to find windows version installed in your system >
Go to CMD and type wmic os get osarchitecture


  1. Or You may use Go to My Computer, right click, Properties >

How to find out eclipse version installed in your system/windows >


Go to eclipse/.eclipseproduct contains name, id and version info of eclipse >
name=Eclipse Platform
id=org.eclipse.platform
version=4.3.0

Go to eclipse/configuration/config.ini contains name, id and version info of eclipse >
eclipse.buildId=4.3.0.I20130605-2000


Go to eclipse/readme/readme_eclipse.html contains more detailed info about eclipse.


Find eclipse installed is 32 bit version or 64 bit version>
Go to eclipse/eclipse.ini
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20130521-0416


64 here is 64 bit, if it contains 32 bit then it will contain 32.

Summary -
So in this tutorial we solved the issue - Failed to load the JNI shared Library.



Having any doubt? or you you liked the tutorial! Please comment in below section.
Please express your love by liking JavaMadeSoEasy.com (JMSE) on facebook, following on google+ or Twitter.


RELATED LINKS>

Collection - List, Set and Map all properties in tabular form


eEdit
Must read for you :