Question
When I open Eclipse, it displays this error and then closes:
Failed to load the JNI shared library "C:/JDK/bin/client/jvm.dll".
The file exists at that location. Both Eclipse and the Java SE Development Kit are installed as 64-bit versions, and my system supports 64-bit software. Most suggested fixes recommend installing 32-bit Eclipse and a 32-bit JDK, but I would prefer to keep a 64-bit setup. What should I check or configure to resolve this error?
Short Answer
This page explains how Eclipse starts a JVM, why loading jvm.dll can fail even when the file exists, and how to diagnose architecture, JDK-path, and configuration problems without immediately switching to 32-bit software.
Concept
Eclipse is a native desktop application that must start a Java Virtual Machine (JVM) before the Java-based parts of the IDE can run. On Windows, the JVM is implemented by a dynamic-link library named jvm.dll.
The message Failed to load the JNI shared library means Eclipse's launcher could not load the JVM library it was told to use. JNI stands for Java Native Interface: it is the bridge that allows native programs, such as the Eclipse launcher, to interact with the JVM.
A file existing on disk is necessary, but it is not sufficient. Windows can refuse to load a DLL when, for example:
- The Eclipse launcher and
jvm.dllhave different architectures, such as 32-bit versus 64-bit. - Eclipse is configured to use an outdated, incomplete, or incorrect Java installation.
- The configured
-vmpath points to the wrongjvm.dlllocation. - A Java installation is damaged or its required DLL dependencies cannot be found.
- Environment variables or launch configuration select a different Java installation than expected.
The core rule is: the native Eclipse launcher and the JVM library it loads must have compatible architecture and come from a valid Java installation. A 64-bit version of Windows can run both 32-bit and 64-bit programs, but a 64-bit native process cannot load a 32-bit DLL, and a 32-bit native process cannot load a 64-bit DLL.
Mental Model
Think of Eclipse as a 64-bit electrical appliance and jvm.dll as a power adapter. The adapter may be sitting on the desk, but Eclipse can use it only if its connector matches.
A 64-bit Eclipse launcher requires a 64-bit JVM library. A 32-bit Eclipse launcher requires a 32-bit JVM library. A 64-bit version of Windows is like a building with outlets for both appliance types, but it does not make mismatched plugs fit together.
The eclipse.ini file is Eclipse's instruction card. If that card tells Eclipse to use an old or wrong adapter, Eclipse may ignore the JDK you intended to use and fail before the IDE opens.
Syntax and Examples
On Windows, Eclipse can be directed to a particular JVM by adding a -vm entry to eclipse.ini, usually located beside eclipse.exe.
-vm
C:\Program Files\Java\jdk-21\bin\server\jvm.dll
Important rules:
- Put
-vmbefore-vmargsineclipse.ini. - Put the option and its path on separate lines.
- Point to the JVM library file, not merely the JDK directory.
- Use a JDK whose architecture matches
eclipse.exe.
A simplified configuration might look like this:
-startup
plugins/org.eclipse.equinox.launcher_1.6.0.v20200000.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.2.0.v20200000
-vm
C:\Program Files\Java\jdk-21\bin\server\jvm.dll
-vmargs
-Xms256m
-Xmx2048m
The exact plugin names and versions vary by Eclipse release. The relevant part is the -vm setting.
On many modern 64-bit JDK installations, the JVM library is commonly under bin\server\jvm.dll. An error mentioning bin\client\jvm.dll can be a clue that Eclipse is using an older configuration or a Java installation layout that is not the one you expected. Do not assume every JDK uses the same directory layout; verify the actual location in the JDK you installed.
Step by Step Execution
Consider this eclipse.ini fragment:
-vm
C:\JDK\bin\client\jvm.dll
-vmargs
-Xmx1024m
When Eclipse starts:
- Windows starts the native
eclipse.exelauncher. - The launcher reads
eclipse.ini. - It sees
-vmand choosesC:\JDK\bin\client\jvm.dllinstead of automatically searching for Java. - The launcher asks Windows to load that DLL.
- Windows checks whether the DLL can be loaded into the Eclipse process. This includes checking native architecture and required dependencies.
- If the DLL is incompatible, invalid, or cannot load its dependencies, Eclipse displays the JNI shared-library error and exits.
To diagnose the selected Java installation, run these commands in Command Prompt:
where java
java -version
echo %JAVA_HOME%
where java shows which java.exe files are found through PATH. java -version reports the JVM used by that command. These commands help identify conflicting installations, but Eclipse may still use a different JVM when eclipse.ini contains -vm.
Real World Use Cases
This issue is an example of a broader native-library compatibility problem.
- IDE startup: Eclipse, Android development tools, and other Java tools may need to load a JVM before their Java code can run.
- Java server integrations: Application servers can fail at startup if a service wrapper is 64-bit but is configured with a 32-bit JVM library.
- JNI-based Java applications: A Java application that loads a native database, image-processing, or hardware-driver DLL must use a library compiled for the JVM's architecture.
- Build agents: CI machines often have several JDKs installed. A build tool can select the wrong JDK through
JAVA_HOME,PATH, or a tool-specific configuration. - Desktop installers: An installer may create a shortcut or configuration file that continues pointing to a removed Java version after an upgrade.
Real Codebase Usage
Developers and operations teams usually avoid relying on whichever Java installation happens to appear first in PATH.
Common patterns include:
- Pin the JDK path: Configure a tool, service, or build system to use one known JDK version.
- Validate at startup: Scripts check that Java exists and print
java -versionbefore running the main program. - Use an explicit architecture policy: Teams standardize on 64-bit tools and JDKs for a development environment, rather than mixing installers.
- Keep tool-specific configuration local: Eclipse's
eclipse.inicontrols Eclipse directly; changing global variables is not always necessary. - Avoid stale paths after upgrades: When replacing a JDK, update configuration files, service definitions, and CI settings that reference the old directory.
For example, a Windows launch script can fail early with a useful message:
@echo off
if not exist "%JAVA_HOME%\bin\java.exe" (
echo JAVA_HOME does not point to a valid JDK.
exit /b 1
)
"%JAVA_HOME%\bin\java.exe" -version
This does not configure Eclipse itself, but it demonstrates the useful real-world practice of validating an external runtime before depending on it.
Common Mistakes
Assuming that an existing DLL must be loadable
This reasoning is incomplete:
C:\JDK\bin\client\jvm.dll exists, so Eclipse should start.
The DLL can exist while still being the wrong architecture, corrupt, missing dependencies, or selected from the wrong Java installation.
Matching Windows architecture but not application architecture
A 64-bit Windows installation can run both kinds of applications. It does not allow this combination:
64-bit eclipse.exe + 32-bit jvm.dll
Match Eclipse and the JDK to each other, not just to Windows.
Editing eclipse.ini with -vm after -vmargs
This is a common incorrect layout:
-vmargs
-Xmx1024m
-vm
C:\Program Files\Java\jdk-21\bin\server\jvm.dll
Arguments after -vmargs are passed to the JVM rather than interpreted as launcher options. Put -vm before -vmargs.
Pointing -vm at a folder or java.exe
When using this form of configuration, use the actual JVM library path required by the launcher:
Comparisons
| Situation | Will it work? | Reason |
|---|---|---|
| 64-bit Eclipse + 64-bit JDK | Yes, normally | The launcher and JVM library have matching architecture. |
| 32-bit Eclipse + 32-bit JDK | Yes, normally | The launcher and JVM library have matching architecture. |
| 64-bit Eclipse + 32-bit JDK | No | A 64-bit process cannot load a 32-bit jvm.dll. |
| 32-bit Eclipse + 64-bit JDK | No | A 32-bit process cannot load a 64-bit jvm.dll. |
| 64-bit Windows + either matched pair | Usually | The operating system supports both 32-bit and 64-bit processes. |
| Configuration source | What it affects | Priority in practice |
|---|
Cheat Sheet
jvm.dllis the native JVM library on Windows.- Eclipse must load a JVM before the IDE can run.
- The Eclipse launcher and
jvm.dllmust have the same architecture. - A 64-bit Windows system can run 32-bit and 64-bit apps, but one process cannot load a DLL of the other architecture.
- Check
eclipse.inifor:
-vm
C:\path\to\jdk\bin\server\jvm.dll
- Put
-vmbefore-vmargs. - Verify the chosen path points to the intended JDK, not an old JRE or removed installation.
- Use these diagnostics:
where java
java -version
echo %JAVA_HOME%
- Do not use a 32-bit JDK with 64-bit Eclipse merely because Windows is 64-bit.
- If the selected JDK cannot load, reinstall a supported JDK and update the explicit path.
FAQ
What does “Failed to load the JNI shared library” mean in Eclipse?
It means the Eclipse launcher could not load the JVM's native library, jvm.dll, so Eclipse cannot start its Java runtime.
Why does Eclipse report this error when jvm.dll exists?
Existence only proves the path contains a file. The file may have the wrong architecture, be damaged, lack dependencies, or belong to the wrong Java installation.
Does 64-bit Windows require 64-bit Eclipse and Java?
No. Windows can run either architecture. However, Eclipse and the JVM it loads must match each other: 64-bit with 64-bit, or 32-bit with 32-bit.
Where should I configure the JDK used by Eclipse?
Check the eclipse.ini file next to eclipse.exe. An explicit -vm entry can specify the JVM library Eclipse should load.
Should -vm point to java.exe or jvm.dll?
For the eclipse.ini pattern shown here, point it to the JVM library file, such as ...\bin\server\jvm.dll, following the layout present in your JDK.
Why is Eclipse trying to use bin\client\jvm.dll?
That path may come from an old Eclipse configuration, an older Java layout, or a manually configured JVM path. Inspect and any launch configuration that references it.
Mini Project
Description
Create a Windows batch-file diagnostic that reports which Java executable is selected, shows its version, and checks whether an Eclipse-style JVM library path exists. This mirrors the first checks used when diagnosing a Java tool that cannot load its JVM.
Goal
Build a script that identifies common Java-path configuration problems before starting a Java-based tool.
Requirements
Use where java to list Java executables found through PATH.
Print the Java version when Java is available.
Display the current JAVA_HOME value.
Accept a JVM library path as the first script argument.
Report whether the supplied jvm.dll path exists.
Exit with a nonzero status when the supplied JVM library path is missing.
Keep learning
Related questions
Add External JAR Files to an IntelliJ IDEA Java Project
Learn how to add external JAR dependencies to an IntelliJ IDEA Java project using module libraries, and when to use Maven or Gradle instead.
Avoiding Java Code in JSP with JSP 2: EL and JSTL Explained
Learn how to avoid Java scriptlets in JSP 2 using Expression Language and JSTL, with examples, best practices, and common mistakes.
Call a Method After a Delay in Android Java
Learn how to run Java code after a delay in Android using Handler.postDelayed, manage the main thread, and cancel callbacks safely.