How to Fix ‘Failed to Load the JNI Shared Library’

Eclipse is an open source project which uses a Java plugin system to allow programmers programming in different languages to work together easily. It’s available for many platforms as well. The error mentioned in the title of the article is an error which appears after users try to open Eclipse on their Windows PC.

Failed to Load the JNI Shared Library

Eclipse usually just closes afterward. The problem often appears as soon as users install and run Eclipse. There have been many different methods used to resolve this problem and that is why we have gathered them in a single article for you to check out!

What Causes the ‘Failed to Load the JNI Shared Library’ Error?

The problem is often caused by one or two common issues which are shared among many users who have reported the problem online. Still, there are several ways to deal with the same problem. Check out the list below:

  • Mismatching versions of Eclipse and Java Runtime – Both programs must be either 64-bit or 32-bit or this error is bound to appear. Resolve the problem by switching both programs to the same format.
  • Both the 32-bit and 64-bit versions of Java installed – Eclipse might try to access the wrong one and you should guide it to the proper version by manipulating the Path variable.
  • Eclipse is unaware of the installation folder of Java – You should clarify the confusion by including it in the eclipse.ini file.

Solution 1: Edit the ‘eclipse.ini’ File

This specific problem can occur of the installation of Eclipse fails to understand just what the correct path to the executable might be. That can be resolved easily simply by adding a line inside the Eclipse configuration file available in the installation directory. Make sure you follow the instructions below in order to resolve the problem.

  1. Navigate to the folder’s location in the File Explorer simply by opening a folder and clicking This PC or My Computer from the left navigation pane or by searching for this entry in the Start menu.
Opening This PC in Libraries
  1. In This PC or My Computer, double-click to open your Local Disk and navigate to the installation directory of Java Development Kit. After locating the Java folder, navigate to jrex.x.xx > bin and locate the ‘jawaw.exe’ file. Click the address bar and copy the full address to Clipboard. The ‘x.x.xx‘ placeholder represents the version of Java you have installed.
Location of jawaw.exe
  1. Navigate to the Eclipse’s installation folder. The correct location can also be found after right-clicking the Eclipse shortcut and choosing the Open file location option from the context menu.
  2. Right-click the file called named ‘eclipse.ini’ and choose to open it with Notepad. Make sure you navigate to the top of the file and paste the lines below in order to resolve the problem. Make sure you also replace our placeholder address with the address you found out in the first part of the solution:
  1. Try running the program again and check to see if the ‘failed to load the JNI shared library’ error comes up.

Solution 2: Make Sure Eclipse and Java Versions Match

If you are using a 64-bit version of Eclipse, you should also make sure you install the 64-bit version of Java Runtime. The same goes for the 32-bit version. Make sure you follow the instructions below in order to uninstall the one and install the second option.

Uninstalling Java on Windows 10

  1. Click on the Start menu button located at the bottom left part of your screen. Select Settings by clicking on the gear icon above the Power button in Start menu.
  2. Select Apps section in the Settings app. Select Java from the list of installed apps and then click its Uninstall
Uninstalling Java on Windows 10
  1. Respond to the instructions displayed on screen to complete the uninstall process.

Uninstalling Java on Previous Versions of Windows

  1. Click on the Start menu button located at the bottom left part of your screen.
  2. Select Control Panel from Start menu and switch the View by option to Category. Select Uninstall a Program under the Programs section.
Uninstalling a program in Control Panel
  1. Select Java from the list of installed programs by clicking on it, and then click the Uninstall Follow the instructions on the screen to complete the wizard.

Installing Java

There are two ways of installing Java. You can either use the online installer which only downloads a small file which is used to download the entire program or you can download the entire package and install it without an active Internet connection. Here is how to install it offline:

  1. Go to the Manual download page and click on Windows Offline. Make sure you differentiate between Windows Offline which is the 32-bit version and Windows Offline (64-bit) which is obviously the 64-bit version.
Downloading Java
  1. The File Download dialog box appears prompting you to run or save the download file Click Save to download the file to your local system.
  2. Close all applications including your browser and double-click on the saved file to start the installation process. Click the Install button to accept the license terms and to continue with the installation.
Installing Java
  1. Oracle has partnered with companies that offer various products. The installer may present you with an option to install these programs when you install Java. After ensuring that the desired programs are selected, click the Next button to continue the installation.
  2. A few brief dialogs confirm the last steps of the installation process; click Close on the last dialog. This will complete the Java installation process. Check to see if the problem still appears after you match the versions of Eclipse and Java Runtime.

Solution 3: Remove the Path Variable for Java

If you have both the 32-bit and the 64-bit version of Java installed on your computer, Eclipse may get confused trying to figure out which one to use. For example, if a 64-bit version of Eclipse tries to use the 32-bit version of Java, a problem will appear. This can be resolved without uninstalling one version of Java simply by deleting its Path variable. Make sure you follow the instructions below carefully.

  1. Right-click either on My Computer/This PC depending on the version of Windows you have installed on your computer and choose the Properties After that, locate the Advanced system settings button at the right side of the Properties window, click on it, and navigate to the Advanced tab.
Advanced System Settings in This PC Properties
  1. At the bottom right section of the Advanced tab, you will be able to see the Environment Variables option so click on it and you will be able to see a list of all user variables under the User variables section.
Environment Variables in System Properties >> Advanced
  1. Click the Path variable under System variables or the User variables section and click the Edit button below. Try to locate a path for the Java folder, select it and choose Delete from the left-side menu. This refers to the Java folder which doesn’t match the version of Eclipse.
  2. Try reopening the program and check to see if it will run properly now.

Kevin Arrows

Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.