[java] Registry key Error: Java version has value '1.8', but '1.7' is required

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.

This question is related to java java-8 sencha-touch sencha-touch-2 sencha-cmd

The answer is


As for me on win7 64bit.

Copy the java.exe javaw.exe javaws.exe in the folder C:\Program Files\Java\jre1.8.0_91\bin to the C:\Windows\System32.

and then open cmd, type java -version.

C:\Users\HEcom>java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

Before the above make sure the Registry's CurrentVersion is 1.8

In the START menu type "regedit" to open the Registry editor

  1. Go to "HKEY_LOCAL_MACHINE" on the left-hand side registry explorer/tree menu
  2. Click "SOFTWARE" within the "HKEY_LOCAL_MACHINE" registries
  3. Click "JavaSoft" within the "SOFTWARE" registries
  4. Click "Java Runtime Environment" within the "JavaSoft" list of registries here you can see different versions of installed java
  5. Click "Java Runtime Environment"- On right hand side you will get 4-5 rows . Please select "CurrentVersion" and right Click( select modify option) make sure the version is "1.8"

aribeiro answer has worked for me - with minor changes

  • I Removed the reference to C:\ProgramData\Oracle\Java\javapath; from the Path environment variable
  • I made /path/to/jdkhome as the first entry in my PATH environment variable. I think this alone is all that is needed.

My short contribution, for sharing the same problem with Talend Open Studio 64 bit version.

  1. Launch ..\TOS_DI-Win32-20150702_1326-V6.0.0\TOS_DI-win-x86_64.exe manually (not link an startup Windows menu)
  2. and this registry error message appears

To resolve this, remove all java.exe, javaw.exe and javaws.exe files on c:\ProgramData\Oracle\Java\javapath\

and TOS start with 64 bits version correctly !


I have had the similar problem. Moving the JDK and JRE path to the top of the path variable solved the problem (which takes first priority over what is present under System32)

For example, here is mine:

enter image description here


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:

echo $JAVA_HOME

Output should be something like this:/usr/lib/jvm/java-8-oracle. Near this directory, you should see java-7 directory. After you found it, run

export JAVA_HOME=${java-7-dir}

Change {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.


Remove it from the System path:

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem

And it will fix the issue in upgrading java version from 1.7 to 1.8


Just Install Java SE Runtime Environment JRE 7 !

Now you see "java 7" & "java 8" in "Programs and Features" in the "Control Panel"

It worked for me.


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? ..."

Reproduction steps

  1. install jdk-7u80-windows-x64.exe

notes:

  • the java.exe executable available in the users %PATH% is installed in C:\Windows\System32
  • the installation does not update the users %PATH%
  • the HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment > CurrentVersion string registry entry is created (among others) with the value 1.7
  1. install jdk-8u191-windows-x64.exe

notes:

  • the users %PATH% is updated to include C:\Program Files (x86)\Common Files\Oracle\Java\javapath as the first entry
  • the the HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment > CurrentVersion string registry entries value is updated to 1.8
  1. update the users %PATH% environment variable, remove C:\Program Files (x86)\Common Files\Oracle\Java\javapath

  2. 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.

Solution(s)

  1. 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.

  2. 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%).

  3. make surejava.exe 1.8 is the first found in the users %PATH% (how you do that is irrelevant) i.e.:

    • update the users %PATH% to include C:\Program Files (x86)\Common Files\Oracle\Java\javapath first (ensure that the executables in that directory are correct)
    • update the users %PATH% to include the absolute path of your java binaries first (set PATH="C:\Program Files\Java\jre1.8.0_191\bin;%PATH%")
    • set java specific environment variables and update the users %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%)

There exist somewhere another java.exe from jre version 1.8 that it is in "path" you should find and delete it if it is possible. it may be in user tempdata for applications that need jre.


Unistall Java 8 from your program list. BY following below steps:-

From your desktop, click on the Start Menu (or Start ball) at the lower left of your screen. Go to the Control Panel. Click on Programs and Features. Select Java8 and click Uninstall


Kill all applications related to java in task manager and then delete the Java.exe , Javaw.exe and Jawaws.exe from C:\windows\System32

This should solve your problem... :)


In addition to Anand Gupta's answer, make sure no other java except for the one you need is used. Run which java (where java for Windows) and see which java executables are used. Just delete the ones you don't want to use and if the one you need is not present, add it to PATH.


My System:- Windows 8.1

Java Environments

  • C:\JavaEnvironment\Java\jdk1.8.0_161
  • C:\JavaEnvironment\Java\jdk1.7.0_75

I recently installed Oracle 11g XE and I received the mentioned error message when accessed "java" command at command prompt.

I checked my environment variables, checked the sequence (as mentioned by previous replies) and detected that my system PATH variable had following entry as first entry:

C:\OracleDatabase\oraclexe\app\oracle\product\11.2.0\server\bin;

I changed the sequence and defined JDK path as first entry:

enter image description here

I replicated the same change to User Variable: Path

enter image description here

After finishing the above activity, I restarted the command prompt and executed java -version command and the problem had vanished. It displayed Java 8 as the current version.


Please change JAVA_BIN and JAVA_HOME system variable, and then restart system or maybe relogin. You are having that error because it is still jdk1.7 path. On windows it is like this: enter image description here


I've had the same problem. Simple solution that worked for me is to rearrange the entries in the PATH for JRE/JDK. This problem started to appear after installing JRE 8 whose installation has put some executable files in System32 or SysWOW64 directories, these executable files are messing up. To resolve the problem:

  1. Create environment variable pointing to JDK home as JAVA_HOME.

    set JAVA_HOME=C:\Progra~1\Java\jdk1.8.0_45

  2. Put the entry %JAVA_HOME%\bin at start in your PATH environment variable. Appending existing value of PATH. For example:

    path=C:\Program Files\Java\jdk1.8.0_45\bin;%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.


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:

C:\ProgramData\Oracle\Java\javapath

[or wherever it is on your desktop]

so your PATH will look something like this - mine for example

PATH=C:\ProgramData\Oracle\Java\javapath;<other path directories>;E:\Program Files\Java\jdk1.8.0_77\bin;E:\Program Files\Java\jre1.8.0_77\bin

You will then see the correct, current version:

C:\>java -version
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)

My experience:

I am using windows 8.1 and i have downgraded JAVA version from 1.8 to 1.7 and i was getting the same error.

Error: Registry key 'Software\JavaSoft\Ja has value '1.7', but '1.8' is required.

I have deleted java.exe, javaw.exe and javaws.exe from C:\Windows\System32 folder and it worked for me.


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:

@echo off
set JAVA_HOME=<YOUR JDK 7 HOME>
set PATH=%JAVA_HOME%\bin;%PATH%
set SENCHA_HOME=%~dp0
java -jar "%SENCHA_HOME%\sencha.jar" %*

Place it at sencha folder, in my case is

C:\Users\<YOUR USER>\bin\Sencha\Architect\Cmd\6.2.0.103

The following step is to change PATHEXT enviroment varible. Change at user variables to have the least impact possible.

I change from

COM;.CMD;.EXE;.BAT;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

to

COM;.BAT;.EXE;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

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.


After the latest automatic Java update, I could not run Java from the command prompt.

My path variable had 'C:\ProgramData\Oracle\Java\javapath;'

I could not cd into 'C:\ProgramData\Oracle\Java\javapath;' from the command prompt window, since it did not exist.

I removed C:\ProgramData\Oracle\Java\javapath;' from the path variable and replaced it with 'C:\Program Files\Java\jre1.8.0_141\bin;'


My solution for this problem came after reading and trying all of the above.

In my case I tried to downgrade Java to use printouts in Apache ActiveMQ. After uninstalling all Java versions and cleaning the registry I was getting the same error

Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion' has value '1.7', but '1.8' is required."

In my case I needed to go to environment variables, edit path, open the javapath location (C:\ProgramData\Oracle\Java\javapath) and there it was - three files (java.exe, javaw.exe, javaws.exe) that remained from the JRE8 version.

After establishing this fact I simply switched them with the same files from C:\Windows\SysWOW64 directory (those were from the JRE7 version) and it all worked perfectly.


In my case (Windows 7 64-bit), I just did the following:

  • Removed the reference to C:\ProgramData\Oracle\Java\javapath; from the Path environment variable
  • Removed files java, javaw and javaws from the C:\Windows\System32 folder

Afterwards, I closed all open command line consoles, reopened them and ran java -version.


  1. open regedit
  2. go to [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment]
  3. change value CurrentVersion from "1.8" to "1.7"

just did this and it worked

HKLM > SOFTWARE > JavaSoft > Java Runtime Environment

just manually change current version to 1.7 .

lol ... but it worked!


I had this error on some windows services running Java. In the end, on my machine I tried to uninstall the other versions of java.

I left only 1.8 and now everything is working.


I didn't delete any of the java.exe files, but changed the ordering of my System - "path" variable - so that it reflected %JAVA_HOME%\bin as the first entry. That did the trick.


Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to java-8

Default interface methods are only supported starting with Android N Class has been compiled by a more recent version of the Java Environment Why is ZoneOffset.UTC != ZoneId.of("UTC")? Modify property value of the objects in list using Java 8 streams How to use if-else logic in Java 8 stream forEach Android Studio Error: Error:CreateProcess error=216, This version of %1 is not compatible with the version of Windows you're running Error:could not create the Java Virtual Machine Error:A fatal exception has occured.Program will exit What are functional interfaces used for in Java 8? java.time.format.DateTimeParseException: Text could not be parsed at index 21 Java 8 lambda get and remove element from list

Examples related to sencha-touch

Registry key Error: Java version has value '1.8', but '1.7' is required

Examples related to sencha-touch-2

Registry key Error: Java version has value '1.8', but '1.7' is required ActiveXObject is not defined and can't find variable: ActiveXObject

Examples related to sencha-cmd

Registry key Error: Java version has value '1.8', but '1.7' is required