"Could not find Java SE Runtime Environment." after installing Java

azBrian picture azBrian · Oct 12, 2013 · Viewed 86.5k times · Source

I was trying to set up Eclipse for trying my hand at Android app dev. I downloaded Eclipse and tried to run it... discovered I needed Java JDK. Googled and found JDK 7u40 (jdk-7u40-windows-x64.exe) and installed it. The install seemed to have gone dandy but when I tried to run Eclipse I got an error as well as if I try java version in cmd.

Error: opening registry key 'Software\JavaSoft\Java Runtime Environment'
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.

I went to regedit, HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft and Java Runtime Environment doesn't exist in there. Seems like this is more of a symptom than the root cause of my problems.

My PATH looks like

PATH=C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program File
s (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Window
s;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Progra
m Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Window
s Live\Shared;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\AIR\bin;C:
\Program Files (x86)\nodejs\;C:\SDK\Android\tools;C:\SDK\Android\platform-tools;
C:\SDK\ANT\apache-ant-1.9.2\bin;C:\Program Files\Java\jdk1.7.0_40\bin\

%JAVA_HOME% = C:\Program Files\Java\jdk1.7.0_40

I'm running Windows 7 Pro 64-bit

I did already read through Error when checking Java version: could not find java.dll and linked materials

Answer

azBrian picture azBrian · Oct 14, 2013

Finally found a forum post that outlined what the registry is supposed to look like when not broken.

  1. Added key HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment
  2. Added String Value CurrentVersion = 1.7
  3. Added key HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.7
  4. Added String Value JavaHome = C:\Program Files\Java\jre7

Running cmd java -version and Eclipse now works