"Could not find Java SE Runtime Environment." after installing Java
Asked Answered
A

9

11

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

Apiary answered 12/10, 2013 at 0:12 Comment(3)
Did you mix 32-bit and 64-bit java and eclipses?Plate
java -version also returns the registry error... so I don't thinks it's simply a mismatch problem. My best guess is that one of the older versions of Java that I uninstalled may have screwed up my registry a bit.Apiary
You can resolve it in simple way. Just un-install java from control panel and install it again, set java home and add it to path will work.Harleigh
A
22

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

Apiary answered 14/10, 2013 at 18:32 Comment(3)
It should not be necessary to do this. The Java installer will set these keys up for you. If they are missing, reinstall your JRE.Roguery
where is the registry?Pinot
This solution is still good in 2022, except version 1.7 shall be replaced by 1.8Bacon
L
5

You can tell eclipse which JRE to use in the eclipse.ini. If you've installed bundles that require 1.7 in your IDE you will need a 1.7 JRE to run the IDE itself. add the below lines to eclipse.ini file

-startup plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
-vm C:\Program Files (x86)\Java\jre7\bin\javaw.exe
.
.
.

Lisettelisha answered 28/6, 2014 at 12:38 Comment(0)
S
4

You can try reinstall your JDK. I've had this problem because I uninstalled so many java things in my PC. And when I open Eclipse, the error occurred.

Swam answered 27/2, 2014 at 21:38 Comment(0)
L
2

A 32 bit eclipse cannot load a 64 bit Java Runtime Environment.

Try again with a 32 bit Java Runtime Environment, or (preferred) upgrade your Eclipse to a 64 bit version.

Also, a good idea (from the command line)

C:> java -version

Which should give you details about your JVM. If it doesn't work, focus on fixing that before fixing Eclipse's use of Java.

Languishment answered 12/10, 2013 at 0:21 Comment(1)
java -version also returns the registry error... which I already knew and had stated in the op. I am focusing on fixing that but do not know what the next steps I should take are.Apiary
H
1

As most of us suggested to edit the registry, but in case you don't want to, because it's risky or you don't have permissions to do so, you can uninstall all the java version, restart your machine, install desired java version, make sure to set path settings. This worked for me.

Henton answered 13/5, 2015 at 8:26 Comment(0)
T
0

I was getting the same error (below) for Oracle when I clicked on a G2 application.

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

Error: could not find java.dll

Error: Could not find Java SE Runtime Environment.

I restarted the machine, still the same.

I reinstalled the app (which includes Oracle), still the same.

I checked all the suggested registry settings as suggested and my registry was fine.

I checked the shortcut path and it fires up javaw.exe with a string following within the shortcut. I navigated to the G2 program files and I tried clicking in the javaw.exe directly within the application folder and got the same error.

I did some research into this and found that Java has a Javaw.exe within the following path:

C:\Program Files\Java\jre7\bin\javaw.exe

I navigated to the path and clicked on this javaw.exe file and didn't get any errors

I renamed the javaw.exe in the G2 app to javaw_old.exe and then copied and pasted the javaw.exe file from the above path into my app folder. Files side by side, you could see a file size difference and the date was 8 months difference. The newer and larger file being the one in the latest Java install folder.

Clicked on the G2 shortcut and the application opened without any errors.

If you have the same issue as me where everything Java is okay and your still getting the error, try find the java(.exe) file that your app is erroring on, rename it and copy and paste the same file from your Java folder (C:\Program Files\Java\jre7\bin) to the same folder your app's Java file is located.

I hope this helps someone.

Tomi answered 4/4, 2014 at 10:22 Comment(0)
A
0

Just reinstall your JRE. You will probably need to restart a computer after uninstalling.

Aldon answered 9/10, 2014 at 8:49 Comment(0)
M
0

Having both 1.7 and 1.8 caused me this problem. While uninstalling 1.8 some of the 1.7 registry keys were removed I guess. I was missing the key Java Runtime Environment and JavaHome String. Uninstalling all the versions of JDK and reinstalling the 1.7(update 80) solved me the problem.

Moton answered 31/7, 2015 at 11:13 Comment(0)
A
0

I had exactly the same problem and exactly same set of errors. That was because my registry key Java Runtime Environment was missing altogether. I did not have any conflicting 32/64 bit settings or any conflicting 1.7/1.8 settings.

All I did was install an update provided by Java and my settings went haywire. What I did to resolve was, instead of updating registry entries myself, I simply did an uninstall and fresh install of JRE and everything was back to normal.

Antiperistalsis answered 4/5, 2018 at 6:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.