How to fix Eclipse Error could not find java.dll
Introduction
In this tutorial, we will go through the steps involved in how to fix the Eclipse error could not find java.dll. Eclipse installation depends on clean Java install on the machine. This error is due to corrupt java install on the machine.
Eclipse Error during the launch
Error: opening registry key ‘Software\JavaSoft\Java Runtime Environment’
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.
Root Cause: Java Corrupt Install
Fix for this error is to identify the corrupt Java install and reinstall it on the machine. In case of multiple Java installations, remove the corrupt install from the PATH variable.
Open a command shell and issue the following command:
>java -version
Error: opening registry key ‘Software\JavaSoft\Java Runtime Environment’
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.
Multiple Java Installs
Check the PATH variable to check if we have added multiple Java install paths. This error could be due to one of the corrupt Java install that has been specified in the PATH.
Fix:
In this case, we need to identify the corrupt install and remove the corrupt Java install path from the environment variable.
Check Environment variables
To check JAVA_HOME on Windows:
Sample command
>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_121
To check PATH variable on Windows:
Sample command
>echo %PATH% C:\oraclexe\app\oracle\product\11.2.0\server\bin;C:\ProgramData\Oracle\Java\ javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem; C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ ATI Technologies\ATI.ACE\Core-Static;C:\maven\bin;C:\Program Files\ Java\jdk1.8.0_121\bin;C:\Program Files (x86)\Silverfrost\FTN95; C:\Program Files\MATLAB\R2017b\bin;C:\codeblocks\MinGW\bin; C:\Program Files\MySql\bin;C:\WINDOWS\System32\OpenSSH\; C:\Program Files (x86)\Java\jdk1.8.0\db\bin;C:\Program Files\MongoDB \Server\4.0\bin;C:\ffmpeg\bin;C:\Python27;C:\Users\vani\AppData\Local \Android\Sdk\platform-tools;C:\Users\vani\AppData\Local\Microsoft\WindowsApps; C:\Fortran\g95\bin;C:\sqlite
In this case, there are multiple Java installs, and any could be corrupted or removed.
C:\Program Files (x86)\Java\jdk1.8.0\db\bin
C:\ProgramData\Oracle\Java\javapath
C:\Program Files\Java\jdk1.8.0_121\bin;
The Oracle product that was removed from the machine still had it pointed in the PATH variable. Removing the entry from the PATH fixed the problem.