Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sencha Cmd 5 + Java 8 Error

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.

like image 405
sherb Avatar asked Jan 05 '15 19:01

sherb


2 Answers

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.

like image 60
vanmelle Avatar answered Oct 11 '22 13:10

vanmelle


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.

like image 45
korgoth Avatar answered Oct 11 '22 15:10

korgoth