While running
sencha app build production
I am getting the following error:
Error: Registry key \'Software\\JavaSof
The error is explicit ...
Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion' has value '1.8', but '1.7' is required.
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.
... you are attempting to use the java.exe 1.7 executable while the HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment > CurrentVersion registry key has the value 1.8.
The recurring theme to proposed solutions is that the error is a configuration error. The error can be solved in various different manners (e.g. reconfiguration of the users environment or removal of java executables with fingers-crossed and hope that there exists another fallback java.exe in the users %PATH% and that the fallback java.exe is the correct executable).
The correct solution depends on what you're trying to achieve: "are you trying to downgrade from jdk-8 to jdk-7? Are trying to upgrade to jdk-8? ..."
notes:
- the
java.exeexecutable available in the users%PATH%is installed inC:\Windows\System32- the installation does not update the users
%PATH%- the
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment>CurrentVersionstring registry entry is created (among others) with the value1.7
notes:
- the users
%PATH%is updated to includeC:\Program Files (x86)\Common Files\Oracle\Java\javapathas the first entry- the the
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment>CurrentVersionstring registry entries value is updated to1.8
update the users %PATH% environment variable, remove C:\Program Files (x86)\Common Files\Oracle\Java\javapath
in a new command prompt java -version
Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion' has value '1.8', but '1.7' is required.
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.
OP's solution https://stackoverflow.com/a/29769311/1423507 is a "fingers-crossed and hope that there exists a fallback java.exe in the users %PATH% and that the fallback executable is correct" approach to the error. Given the reproduction steps, removing the java.exe, javaw.exe and javaws.exe executables from C:\Windows\System32 (only in my case) will result in no longer having any java.exe present in the users %PATH% resulting in the error 'java' is not recognized as an internal or external command, operable program or batch file. which is not so much of a solution.
answers https://stackoverflow.com/a/35775493/1423507 and https://stackoverflow.com/a/36516620/1423507 work however you're reverting to using java.exe 1.7 (e.g. update the CurrentVersion registry key's value to match the java.exe version found in the users %PATH%).
make surejava.exe 1.8 is the first found in the users %PATH% (how you do that is irrelevant) i.e.:
%PATH% to include C:\Program Files (x86)\Common Files\Oracle\Java\javapath first (ensure that the executables in that directory are correct)%PATH% to include the absolute path of your java binaries first (set PATH="C:\Program Files\Java\jre1.8.0_191\bin;%PATH%")%PATH% with them (set JAVA_HOME="C:\Program Files\Java"; set JRE_HOME=%JAVA_HOME%\jre1.8.0_191; set PATH=%JRE_HOME%\bin;%PATH%)