136

I get this error when I try to do anything with Java in command prompt:

Error opening registry key 'Software\JavaSoft\Java Runtime Environment.3'
Error: could not find Java.dll
Error: could not find Java 2 Runtime Environment

I did screw around with deleting Java directories and registry a few days ago. I restarted computer and java was still working fine, then i restarted it again today and now I get this error. I have tried uninstalling and reinstalling but that doesn't seem to work. I have the latest java JRE installed and the path set in the environment variables. Anyone have any clue how to fix this?

Kevin Panko
  • 8,356
  • 19
  • 50
  • 61
gFu
  • 1,579
  • 2
  • 11
  • 12
  • I tried to uninstall java through command prompt and it messed up my uninstaller. So i manually deleted the folder and deleted the registrys pertaining to it. I rebooted and reinstalled Java after that and it worked fine until my next reboot. – gFu Jun 15 '11 at 18:02
  • 2
    You try to reinstall after the reboot messed it up? Maybe third time's the charm – Atreys Jun 15 '11 at 18:27
  • Yes I have, still doesn't work. – gFu Jun 15 '11 at 18:40
  • Have you tried backing up your other files and reformatting your computer? You could probably do a fresh installation of Java after that. But this method might be overkill – Atreys Jun 15 '11 at 18:46
  • 1
    Somehow I solved it for my particular issue by downloading runtime even though I already had JDK installed. I leave this here in case that actually works for anyone else. – Dave May 04 '18 at 23:20

16 Answers16

237

Make sure you remove any java.exe, javaw.exe and javaws.exe from your Windows\System32 folder and if you have an x64 system (Win 7 64 bits) also do the same under Windows\SysWOW64.

If you can't find them at these locations, try deleting them from C:\ProgramData\Oracle\Java\javapath.

A Jar of Clay
  • 5,622
  • 6
  • 25
  • 39
Baha
  • 2,394
  • 1
  • 15
  • 3
  • 7
    After removing the "java" executables from my system32 folder, I had to reinstall the JRE. After that, my problem was solved. Thanks for the starting point. – dangowans Dec 24 '13 at 18:31
  • 1
    After a security patch installation, I was not able to open eclipse because of this error. Thanks alot! Your solution worked. But I wonder what is the real reason here. – pnv Apr 09 '15 at 00:53
  • 1
    Worked for me ! Thank you ! Also had to reinstall the JRE. – kbonnelly Jan 26 '16 at 01:08
  • 1
    Can you please tell me what is the effect of these files in system32 folder ? – Rabia Naz khan Jul 12 '16 at 05:50
  • 3
    run "where java" to see the location of the executable files mentioned above. Mine where on C:\Program Files (x86)\Common Files\Oracle\Java\javapath – Charis Moutafidis Apr 17 '20 at 22:20
96

You will find a folder named "Oracle" on ProgramData folder in your windows installed drive. Remove the folder. Hope it will work. In my case my install drive is C and my path is C:\ProgramData\Oracle

Shuvankar Paul
  • 1,124
  • 10
  • 11
21

I had a similar problem. I had installed JDK7 update 1 but couldn't use it (probably because I found a JRE6 that I deleted after installing JDK7). Uninstalling JDK7 was impossible. The solution was to add the JRE registry entries by hand.

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment]
"CurrentVersion"="1.7"

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.7]
"JavaHome"="C:\\Program Files\\Java\\jre7"
"RuntimeLib"="C:\\Program Files\\Java\\jre7\\bin\\client\\jvm.dll"

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.7.0_01]
"JavaHome"="C:\\Program Files\\Java\\jre7"
"RuntimeLib"="C:\\Program Files\\Java\\jre7\\bin\\client\\jvm.dll"

You'll have to adjust the above to your own directories and version.

If this doesn't help, there's still JavaRa https://singularlabs.com/software/javara/ .

Tilman Hausherr
  • 17,731
  • 7
  • 58
  • 97
  • Regretfully, this didn't work for us on Windows Server 2016. We continue to get "the specified module could not be found" – Praxiteles Jul 19 '18 at 10:08
  • Sorry to hear that... try all the other solutions, search for the error message... and if you'll find a solution, please share it here, or create a new question. However... "the specified module could not be found" isn't the error message that was discussed in the original question. – Tilman Hausherr Jul 19 '18 at 10:42
  • As of August 2021 http://raproducts.org/wordpress/ just forwards to random clickbait and malware sites. – Daz Aug 31 '21 at 12:06
  • @Daz thank you, I have found where the product is now. Can't believe I wrote this almost ten years ago. Don't know if it still works. – Tilman Hausherr Aug 31 '21 at 12:14
12

Delete these 3 files present in your local at path C:\ProgramData\Oracle\Java\javapath

java.exe
javaw.exe
javaws.exe

This solved the issue for me :)

shikha singh
  • 498
  • 1
  • 5
  • 10
6

Make sure you remove any java.exe, javaw.exe and javaws.exe from your system.

  • if you have an x32 system (Win XP 32 bits) Windows\System32 folder

  • if you have an x64 system (Win 7 64 bits) also do the same under Windows\SysWOW64 folder

Ram
  • 3,092
  • 10
  • 40
  • 56
user3740684
  • 101
  • 1
  • 2
6

There are 3 locations to check

  1. Registry HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.8.0_xxx\JavaHome
  2. Java Control Panel- Java tab - View - Path
  3. Environment Variables - Path ($env:Path)

All 3 have to align (if you have multiple entires just remove the wrong ones) - thats all

Tobias Theel
  • 3,088
  • 2
  • 25
  • 45
6

On Windows 10 I had just installed the JDK, and got these errors when checking the version. I had to delete all executable files starting with java (i.e. java.exe, javaw.exe and javaws.exe) from C:\ProgramData\Oracle\Java\javapath. And then, once deleted, re-run the JDK installer, restart my terminal program and java -v works.

joe_the_third
  • 71
  • 1
  • 2
2

I had the same:

Error opening registry key 'Software\JavaSoft\Java Runtime Environment

Clearing Windows\SysWOW64 doesn't help for Win7

In my case it installing JDK8 offline helped (from link)

Happypig375
  • 1,022
  • 1
  • 12
  • 32
i-mir
  • 21
  • 1
1

I would have tagged this as a comment but cant (dont have the rep) just wanted to thank Tilman. I was trying to get PDFsam (PDF Split and Merge) to work to no avail.

At launch it would produce an error stating that it could not find JRE 1.6.0. I Have both 32 and 64 bit versions and they check out fine at the java website in their respective browsers.

Tried uninstalling/reinstalling and rebooting repeatedly as well as using JavaRa. No such luck, still no go.

I looked in the registry after reading this post and there was no ...\SOFTWARE\JavaSoft\ key so I added each with their respective string values pointing to my x86 version (PDFsam is a 32bit program). This got past the first problem but an error popped up about amd64 libraries suggesting the machine wanted to run the 64bit version. So I changed the paths to the 64bit JRE and PDFsam now works.

FYI - I got here by searching for Java registry keys after I was unable to launch javaw.exe from command prompt (even after adding the requisite paths to system path), making the aforementioned changes solved this as well.

Dizzixx
  • 318
  • 4
  • 13
1

I got this kind of error whe nI had JDK 1.7 before and I installed JAVA JDK 1.8 and pointed my JAVA_HOME and PATH variables to JAVA 1.8 version. When I try to find the java version I got this error. I restarted my machine, and it works . It seems to be we have to restart the machine after modifying the environment variables.

user213013
  • 11
  • 3
0

In case a virus scanner (like McAfee) is running, try:

  1. Disable virus scanner
  2. Uninstall Java (via Control Panel / Programs and Features)
  3. Reinstall Java (from Java.com)
  4. Re-enable virus scanner
zut
  • 806
  • 4
  • 12
0

Uninstall Java (via Control Panel / Programs and Features)

Install Java JRE 7 --> OFFLINE <-- Configure JAVA_HOME and Path = %JAVA_HOME%/bin;%PATH%

Prafulla Kumar Sahu
  • 9,321
  • 11
  • 68
  • 105
dapx
  • 59
  • 1
  • 2
0

I have Windows 7. I got the same problem after installing: PyCharm. I wasn't satisfied with PyCharm, so I decided to use Eclipse instead. This is when I discovered that things went wrong with my JDK. I used to have Java.9.x. So I decided to uninstall it and get the newer version (at my time it was Java.11.x. The same problem persisted. I followed most of the steps mentioned above in the post like: - Removing all java*.exe files, - removing Java related entries from the registry. - Cleaning-up all unnecessary Java folders. However nothing helped. I still had something in the system referring to a broken Java pathname.

What really brought remedy is the following: - Uninstalled what ever version of JDK I had at the moment. - Re-Installed the last JDK version I had before the problem took place - Properly uninstall that version. - Install whatever latest version of SDK. ..

That's it .. at this point everything returned to normal ... Except that Java.11.xx did not fix the system path automatically, I had to do it manually.

Nowfal
  • 1
  • 2
0

I followed multiple answers from above and got my issue resolved.

Issue:

Javac was on 13 from jdk but java was using 1.8 from jre so java threw incompatible runtime error

Fix:

  1. Under Control Panel -> Programs: I uninstalled 1.8 (named Java 8 runtime) and DID NOT touch the other one (named Java (TM) SE Development Kit 13)

  2. Deleted java.exe, javac.exe and javawc.exe files from: a. C:\Windows\system32 b. C:\Windows\SysWOW64 c. C:\ProgramData\Oracle\Java\javapath

  3. The environment variable JDK_HOME was pointing to 13 but JAVA_HOME was pointing to 1.8 so i pointed JAVA_HOME to also use 13 which was C:\Program Files\Java\jdk-13.0.1

  4. There was a Path variable under both User variables and system variables sections. For the one in user variables section, i added the string %JDK_HOME% - which translated automatically to the physical path. For the one under system variables, I deleted the path C:\ProgramData\Oracle\Java\javapath and added C:\Program Files\Java\jdk-13.0.1\bin

All good now! Thanks to all the people who answered, you rock!

Shree Harsha
  • 377
  • 3
  • 9
0

Make sure to delete java references from system32, SysWOW64, and delete javapath from ProgramData\Oracle\Java. It solves the issue

0

If you have "C:\ProgramData\Oracle\Java\javapath" in your PATH, just make sure that the java bin path entries are present before this entry in your PATH.

I was facing the exact same issue, and I just moved the java jdk/jre bin path entries up in the list, above the oracle entry and it resolved my issue.

Sarun
  • 161
  • 1
  • 8