While running
sencha app build production
I am getting the following error:
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.
java -version
, command is showing following:
java version "1.8.0_40" Java(TM) SE Runtime Environment (build 1.8.0_40-b26) Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)
Not able to find where path is going wrong. Any idea?
----------------------- EDIT ------------------------------------------------
Note: I am using Windows 7 (64 bit).
I have tried uninstalling the sencha touch cmd and reinstalling. But still same error.
I have uninstalled all the java version instances and reinstalled the latest one, Still the problem persist.
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment]
CurrentVersion
from "1.8" to "1.7"re: Windows users
No. Don't remove the Javapath environment reference from your PATH variable.
The reason why the registry didn't work is that the Oracle Javapath script needs to run in the PATH sequence ahead of the JRE & JDK directories - it will sort out the current version:
put this directory at the HEAD of your
%PATH%
variable:[or wherever it is on your desktop]
so your PATH will look something like this - mine for example
You will then see the correct, current version:
First you should have Java 7. If you don't have, install it first (I don't know what you are using, Linux, Mac, yum, apt, homebrew, you should find out yourself.)
If you already have Java 7, run:
Output should be something like this:
/usr/lib/jvm/java-8-oracle
. Near this directory, you should seejava-7
directory. After you found it, runChange
{java-7-dir}
with your directory path. Then you can run your command.This is only a temporary solution. To change it permanently, put the above command to your
~/.bashrc
file.EDIT: If you are using Windows, change environment variable of
JAVA_HOME
to your Java 7 installation directory path.You have to define your jdk folder in variable JAVA_HOME, add %JAVA_HOME% to your variable path
Delete or change name of your java.exe, javaw.exe and javaws in your folder system32
execute cmd.exe, java -version now take the new version that you define in JAVA_HOME.
One possible solution to this problem is to add at Sencha CMD folder a bat file as sugested at this thread Sencha Cmd 5 + Java 8 Error.
The batch will have the name "sencha.bat" with this code:
Place it at sencha folder, in my case is
The following step is to change PATHEXT enviroment varible. Change at user variables to have the least impact possible.
I change from
to
The idea is to make windows run .bat files first than .exe files. This is important because in sencha folder there is already an "sencha.exe" file. And in the command line if you type "sencha" it will execute "sencha.exe" instead of "sencha.bat".
This was the only solution that worked for because I'm very restricted when it comes to permissions.
The error is explicit ...
... you are attempting to use the
java.exe
1.7 executable while theHKEY_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 fallbackjava.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? ..."
Reproduction steps
update the users
%PATH%
environment variable, removeC:\Program Files (x86)\Common Files\Oracle\Java\javapath
in a new command prompt
java -version
Solution(s)
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 thejava.exe
,javaw.exe
andjavaws.exe
executables fromC:\Windows\System32
(only in my case) will result in no longer having anyjava.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 theCurrentVersion
registry key's value to match thejava.exe
version found in the users%PATH%
).make sure
java.exe
1.8 is the first found in the users%PATH%
(how you do that is irrelevant) i.e.:%PATH%
to includeC:\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%
)