When you try to open or start Eclipse or other software like Spring Tool Suite (STS), KNIME, Dbeaver, etc on your Windows 11 or Windows 10 computer, you may get the error stating Failed to load the JNI shared library. This post provides applicable fixes to the error that can help affected PC users resolve the issue on their system.
What is a shared library in Java?
In Java, a shared library is files used by multiple applications. Each shared library consists of a symbolic name, a Java classpath, and a native path for loading Java Native Interface (JNI) libraries. Typically, shared libraries can be used to reduce the number of duplicate library files on your system.
Typically, the error message snippet reads as follows:
Failed to load the JNI shared library “C:/JDK/bin/client/jvm.dll”`
PC users that encountered this error reported the problem often appears as soon as you run the software after been installed on the system — the software usually just closes afterward. The error indicates that the Java Native Interface (JNI) library required by the software cannot be found or loaded. This error is known to be triggered often by any of the following common reasons.
- Mismatching architecture (bitness) versions of the problematic software and Java Runtime.
- Java is not installed on the system, or the installation is corrupted.
- Both the 32-bit and 64-bit versions of Java or multiple versions of the problematic software are installed.
- The software doesn’t detect or point to the wrong Java installation folder.
- The JNI library is missing or corrupt.
- System configuration issues.
Fix Failed to load the JNI shared library
If you get Failed to load the JNI shared library when you try to open software like Dbeaver, KNIME, Eclipse, Spring Tool Suite et al on your Windows 11/10 computer, then the solutions we have drawn up and presented below can help you easily fix the error.
- Start the software with the -clean option
- Edit the software .ini file
- Make sure the software and Java versions match
- Remove the Java Path Variable
- Reinstall the software.
Let’s see how these fixes apply. Before you proceed, depending on the software throwing the error on your system, make sure you’re running the latest version/build of the software then see if the issue is resolved. Likewise, try updating your system libraries (this includes .Net Framework and Visual C++ redistributable) and update drivers.
1] Start the software with the -clean option
When you launch the software normally and it throws the Failed to load the JNI shared library error on your Windows 11/10 computer, you can try starting the software with the -clean
option, which will reset the software configuration. To do this, open a command prompt and navigate to the software installation directory,
2] Edit the software .ini file
This fix requires you to edit the problematic software .ini file to make sure the software is pointing to the correct Java installation and the software is configured to use the correct Java version and the Java executable is in the system path. To perform this task, follow these steps:
- Open File Explorer.
- On the C:\ drive, navigate to the installation directory of the Java Development Kit.
- At the location, navigate to jrex.x.xx > bin and select the javaw.exe file. The x.x.xx placeholder represents the version of Java you have installed.
- Now, press the Alt+D key combo to change the breadcrumb navigation and highlight the address bar.
- Press CTRL+C to copy the full file path to the Clipboard. Alternatively, in Windows 11, right-click the exe file and select Copy as path from the context menu.
- Next, navigate to the problematic software installation folder. You can right-click the software shortcut and choose the Open file location option from the context menu.
- At the location, right-click the software ini file (for example, eclipse.ini) and choose to open it with Notepad.
- Now, make sure you navigate to the top of the file and paste the lines below. Substitute the path\to placeholder with the file path you copied from the File Explorer address bar.
-vm C:\path\to\64bit\java\bin\javaw.exe
- Save the file and exit.
Now, relaunch the program and see if the error reappears. If so, continue with the next fix.
3] Make sure the software and Java versions match
For this fix, if you are using a 64-bit version of the problematic software, you should also make sure you install the 64-bit version of Java Runtime. Likewise, you need to do the same if using the 32-bit version. So, if that’s the case, then you can uninstall Java and then download/install the correct Java bitness version to match the software bitness on your system.
4] Remove the Java Path Variable
In the case where you have both the 32-bit and the 64-bit versions of Java installed on your computer, the software throwing the error may be unable to determine the appropriate Java version to use. For example, if a 64-bit version of the software tries to use the 32-bit version of Java, the error is triggered. In this case, to resolve the issue, instead of uninstalling one version of Java, you can simply delete its Path variable by following these steps:
- Press the Windows key + R to invoke the Run dialog.
- In the Run dialog box, type sysdm.cpl and hit Enter to open System Properties.
- Click the Advanced tab.
- At the bottom right section of the Advanced tab, click the Environment Variables button.
- Under the User variables section, you will see a list of all user variables.
- Click the Path variable under System variables or the User variables section
- Click the Edit button below.
- Locate a path for the Java folder (that doesn’t match the version of the problematic software installed), select it, and choose Delete from the left-side menu.
Try reopening the program and checking to see if it will run properly now. If not, proceed with the next fix.
5] Reinstall the software
You can uninstall the software, and then download the latest version of the software and install it on your Windows 11/10 computer. This action will most likely resolve the issue.
I hope this post helps you!
Read next: A JNI error has occurred in Minecraft
What is the purpose of JNI?
With the JNI library, programmers can write native methods to handle situations when an application cannot be written entirely in the Java programming language. For example, this can be used when the standard Java class library does not support the platform-specific features or program library.