问题
After installing Java 8 JDK on my Windows build server, I'm running into the following error when executing the sencha
command:
C:\> sencha
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.
The Sencha Cmd Guide implies that Java 8 isn't supported yet (however Sencha Cmd works fine on my Mac OS X workstation with Java 8):
Sencha Cmd requires Java Runtime Environment version 1.7 to support all functionality...
I've still got JDK 7 installed on the server. Is there any way to force Sencha Cmd to use a different JDK install? Changing JAVA_HOME and PATH sysenvs does not work, and editing the registry isn't an option.
UPDATE: I've run across this question where multiple java.exe
files cause the same error (and that's definitely a possibility here) however maven, ant, tomcat, jenkins, and a slew of other Java tools are working fine. I've only seen this error with Sencha Cmd.
回答1:
To make this slightly more concrete, I followed ben's advice and created the following sencha.bat file in my installation directory:
@echo off
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_75
set PATH=%JAVA_HOME%\bin;%PATH%
set SENCHA_HOME=%~dp0
java -jar "%SENCHA_HOME%\sencha.jar" %*
and I renamed the existing sencha.exe to something innocuous. Now I can simply type "sencha" at the command line without extra fuss. Of course, if you have a different minor version of Java 7, you'll need to edit the JAVA_HOME above.
回答2:
My 'Path' environment variable are mapping 'C:\ProgramData\Oracle\Java\javapath' which contains 3 shortcuts for following files from 'C:\Program Files\Java\jre1.8.0_xx\bin':
- java.exe
- javaw.exe
- javaws.exe
But these files are also present in 'C:\Windows\System32'; if you call 'java' from this directory you will have the same error (Error: Registry key...) By replacing these 3 files in 'C:\Windows\System32' by the one's from 'C:\Program Files\Java\jre1.8.0_xx\bin'; it will solve the issue.
回答3:
Try the following workaround to use the latest SenchaCMD working with JDK8:
- check your PATH environment variable; especially the correct java installation path(s)
- open the command prompt and go to the sencha-cmd folder
to use SenchaCMD just execute the "sencha.jar"-file with java:
java -jar sencha.jar
Now, you should see all version informations about the executed SenchaCMD-Tool.
Tested with JDK 1.8.0u25 and SenchaCMD 5.1.0.26 on W7 Prof. x64
回答4:
I had this exact same thing, found that I was required to update the sencha cmd itself. I had extjs 5.1 cmd 5.1.0 , downloaded extjs 6.0.1 and tried to sencha app upgrade {new_extjs6_path} my app. Received the above error, figured out I was required to update cmd to 6.0.1 as well.
来源:https://stackoverflow.com/questions/27786159/sencha-cmd-5-java-8-error