Reputation: 183
When running "java -version" on command prompt Windows 7, i get this:
Error: opening registry key 'Software\JavaSoft\Java Runtime Environment'
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.
I have already checked environment variables:
JAVA_HOME = C:\Program Files\Java\jdk1.8.0_212\bin
And PATH
includes "%JAVA_HOME%
I have also tried deleting files :
java.exe, javaw.exe and javaws.exe in ProgramData\Oracle\JAVA\Javapath
However, they won't delete. Even though I am an administrator.
I have also checked C:\Windows\System32
and C:\Windows\SYSWOW64
and didnt find java.exe, javaw.exe or javaws.exe to delete.
What else can I try?
Upvotes: 6
Views: 16208
Reputation:
This happened to me when I uninstalled and old Oracle version of Java. The registry key was deleted but a Java executable remained in a hidden folder. For proper cleanup
(on Windows):
where java
will reveal the location of the shortcut, e.g., C:\ProgramData\Oracle\Java\javapath\java.exe
(notice that this is a hidden folder).
Assuming you wanted to get rid of the old Java version, you can delete this folder, and the corresponding path entry.
Upvotes: 2
Reputation: 11
This error also comes when the software you are using is of 32-bit and you have a 64-bit version of Java installed which is not compatible with the existing softwares where you want to work. You may also uninstall 64-bit and install the 32-bit version which will resolve the issue.
Upvotes: 1
Reputation: 4269
regedit
command to open the registry and look for the key you mentioned in your question (HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment\CurrentVersion
). Cleanup/correct the version if you see a discrepancy. JAVA_HOME
should be the path excluding bin
and PATH
should include bin as %JAVA_HOME%\bin
PATH
and also duplication between user and system environment variables? java -version
?C:\Windows\System32
and C:\Windows\SYSWOW64
directories and removed java.exe and related files.Upvotes: 2