why do I get this? How can I fix it?
C:\\Users\\ash>java version
Error: Registry key \'Software\\JavaSoft\\Java Runtime Environment\'\\Cu
"C:\Windows\System32\java.exe" to "C:\Windows\System32\java_old.exe"
java -version
done.
I had a similar issue after installing the java 1.8.
To fix this go to Advance System setting --> path and remove
C:\ProgramData\Oracle\Java\javapath;
This problem generally occurs in windows when your "Java Runtime Environment" registry entry is missing or mismatch with the installed JDK. The mismatch can be due to multiple JDKs.
Steps to resolve:
Open the Run window:
Press windows+R
Open registry window:
Type "regedit" and enter.
Go to: \HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\
If Java Runtime Environment is not present inside JavaSoft, then create new Key and give the name Java Runtime Environment.
For Java Runtime Environment create "CurrenVersion" string key and give appropriate version as value:
Create a new subkey of 1.8.
For 1.8 create a string key with name JavaHome with the value of JRE home:
Ref: https://mybindirectory.blogspot.com/2019/05/error-could-not-find-javadll.html
I edited my path to put the Oracle JDK at the start of the path and that fixed it.
If you face this error in cmd with another error as "could not find runtime environment" after you have done all settings in Environment Variable. Then you just need to run jre.exe in your jdk folder and reinstall it and then recheck it by java -version command. Hope it will help you.
after adding the requirements path as illustrated up and deleting C:\ProgramData\Oracle\Java\javapath;. don't forget to reopen your editor.