86

When I run: C:\Users\ashahria\Downloads>java -jar schemaSpy_5.0.0.jar

I get the error below. What is wrong? How can I fix it?

Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion'

has value '1.5', but '1.7' is required.
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.

Community
  • 1
  • 1
itro
  • 7,006
  • 27
  • 78
  • 121
  • You can read this posts: http://www.velocityreviews.com/forums/t145273-java-jdk-and-java-jre-system-properties.html & http://aosgrp.com/products/jack/documentation_and_instructi/jack_programming_faq/my_windows_computer_tells_m.html & http://www.coderanch.com/t/323565/java/java/Not-able-run-java-exe – Alex K Dec 27 '11 at 13:15

14 Answers14

115

On my Windows 7 machine, it was solved by doing the following:

  1. In the START menu type "regedit" to open the Registry (be careful doing this)
  2. Go to "HKEY_LOCAL_MACHINE" on the left-hand side registry explorer/tree menu
  3. Click "SOFTWARE" within the "HKEY_LOCAL_MACHINE" registries
  4. Click "JavaSoft" within the "SOFTWARE" registries
  5. Click "Java Runtime Environment" within the "JavaSoft" list of registries
  6. Highlight "CurrentVersion" (should see it in the main registry key explorer window on the right)
  7. Change version to "1.7"

That is all... should work. Short of that, if you've already tried some other guides and/or messed up your registries, the most certain way to deal with the problem is to delete all previous versions of Java (using "Programs and Features" uninstall process) and then re-install just the version you want to work with. I'd suggest the distribution site at: http://java.com (as it usually has the most stable version)

Or look for a specific version you need from Oracle's site: http://www.oracle.com/technetwork/java/javase/downloads/

bcmoney
  • 2,889
  • 1
  • 24
  • 30
  • I had 1.7 and 1.8 installed, but no %JAVA_PATH% variable and Java was not in %PATH%. For some reason, executing `java -version` from `C:\Windows\System32\` gave me the same error as in the question, but executing it from any other directory worked fine and reported the latest version. I did this and everything worked, so I assume some update failed to update all files, because in my case I had to downgrade from 1.8 to 1.7. – f.ardelian Jan 05 '15 at 00:31
  • 1
    With [`procmon.exe`](https://technet.microsoft.com/en-us/library/bb896645.aspx) I figured out that my registry path was `HKLM/SOFTWARE/Wow6432Node/JavaSoft/Java Runtime Environment/CurrentVersion`. This might be due to it being a x64 build of java (I was downgrading 1.8 to 1.7 to work with FlashDevelop). – h2ooooooo Jun 12 '15 at 18:16
  • To add to this, in my case I couldn't simply change the version because for some reason I didn't have that version under Java Runtime Environment. What fixed it for me was adding a new key under Java Runtime Environment called '1.7' and in there I added a new String value for JavaHome and set that to the JRE home. – Diana Amza Jun 28 '16 at 08:20
  • Also, is good to remember that if it's greater than 2Gb, it's necessary to install the 64-bit Java – Rafael Baptista Sep 20 '21 at 14:27
  • What makes it to happen this error? – Ajay Takur Jul 28 '23 at 11:11
56

I had various JDK from 1.5 to 1.7 installed on my PC. I had a need to learn JDK1.8 so installed and my earlier versions of Eclipse (depended on earlier versions of JDK) and I got errors launching my Eclipse IDE, on the command line I tried to check the Java Version and got the error below,

C:\>java -version
Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion'
has value '1.8', but '1.6' is required.
Error: could not find java.dll
Error: could not find Java SE Runtime Environment.

Solution:- I removed

C:\ProgramData\Oracle\Java\javapath;
from the PATH variable and moved %JAVA%\bin to the start of the PATH variable, that solved the problem for me.
36

Go to 'c:/Windows/System32' and delete the java.exe, javaw.exe and javaws.exe there. See at Registry Key '...' has value '1.7', but '1.6' is required. Java 1.7 is Installed and the Registry is Pointing to it

Community
  • 1
  • 1
EastOcean
  • 1,222
  • 11
  • 10
11

set PATH=c:\Program Files\Java\jdk1.6.0_45\bin;%PATH%

this will work if you are working on command prompt

BobTheBuilder
  • 18,858
  • 6
  • 40
  • 61
Deep Saxena
  • 205
  • 3
  • 5
4

you may follow these steps :

  • set JAVA_HOME to jdk[without bin folder]
  • set PATH as %JAVA_HOME%/bin;
  • put java.exe , javaw.exe & javaws.exe to C:\ProgramData\Oracle\Java\javapath [I was having problem here].
  • double click on the java.exe
  • Also check and edit the registry value for JAVA current version if required.

it worked for me :)

Cjo
  • 1,265
  • 13
  • 19
3

I had Java 1.8 but had to downgrade to Java 1.6 for some reason. When I uninstalled java 1.8 and ran the command "Java -Version" from the command prompt, I got the error -

Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion'

has value '1.6', but '1.8' is required. Error: could not find java.dll Error: Could not find Java SE Runtime Environment.

Uninstalling 1.6 and then reinstalling 1.6 fixed the issue for me :-)

Umesh Babu
  • 31
  • 1
3

Your java version is 1.5 (you have jdk 1.5). The jar requires java version 1.7 (you should have jdk 1.7). You should download and install the 1.7 jdk from this website:

http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html

Adel Boutros
  • 10,205
  • 7
  • 55
  • 89
  • I have already install 1.5 and 1.6 and 1.7 all with their jre en jdk – itro Dec 27 '11 at 14:54
  • Then you need to know which version your OS is using. To do that go to Command Prompt and type **java**, if the version is less than 1.7 or 7 then you should fix your **JAVA_HOME** envrionmental path variable – Adel Boutros Dec 27 '11 at 15:34
2

Adjust the sequence of your environment variable %path% to make sure jre 1.7 is the default one.

swimmingfisher
  • 901
  • 9
  • 9
2

One Good solution is to restart the PC, this will make the right entry in the Registry of the PC. Restarting solves my problem

Deep Saxena
  • 205
  • 3
  • 5
2

Just Reinstall JDK 1.7 it will work.

2

I tried the steps mentioned by @bcmoney but for me the current version was already set to the latest version. In my it was Java8.

I had various versions of java installed (java6, java7 and java8). I got the same error but instead of 1.5 and 1.7 i got 1.7 and 1.8. I uninstalled java6 on my windows 8.1 machine. After which i tried java -version in command prompt and the error did not appear.

I am not sure whether this is the right answer but it worked for me so i thought it would help the community too.

Sudarsan GP
  • 1,194
  • 14
  • 22
2

I just uninstalled my Java8 update and tried again. It worked ok!

user1517951
  • 736
  • 1
  • 8
  • 14
1

I ran into this issue after updating the Java JDK, but had not yet restarted my command prompt. After restarting the command prompt, everything worked fine. Presumably, because the PATH variable need to be reset after the JDK update.

CatShoes
  • 3,613
  • 5
  • 29
  • 43
1

Other times you might have installed Java 7 and 8 both or twice, and from Add/remove programs unistall one of them and it should work.