可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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.
回答1:
After trying more than hundred of tricks, finally got success.
I removed all java.exe, javaw.exe and javaws.exe from my
Windows\System32 and
Windows\SysWOW64 folder. [Try step 2 if you have x64 system (Win 7 64 bits)]
回答2:
- open regedit
- go to
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment] - change value
CurrentVersion from "1.8" to "1.7"
回答3:
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.
回答4:
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;;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)
回答5:
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.
回答6:
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:
Create environment variable pointing to JDK home as JAVA_HOME.
set JAVA_HOME=C:\Progra~1\Java\jdk1.8.0_45
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%
回答7:
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.
回答8:
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
- Go to "HKEY_LOCAL_MACHINE" on the left-hand side registry explorer/tree menu
- Click "SOFTWARE" within the "HKEY_LOCAL_MACHINE" registries
- Click "JavaSoft" within the "SOFTWARE" registries
- Click "Java Runtime Environment" within the "JavaSoft" list of registries here you can see different versions of installed java
- 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"
回答9:
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.
回答10:
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;'
回答11:
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.
回答12:
My short contribution, for sharing the same problem with Talend Open Studio 64 bit version.
- Launch ..\TOS_DI-Win32-20150702_1326-V6.0.0\TOS_DI-win-x86_64.exe manually (not link an startup Windows menu)
- 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 !
回答13:
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
回答14:
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.
回答15:
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.
回答16:
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: 
回答17:
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.
回答18:
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.
回答19:
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
回答20:
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:

回答21:
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... :)
回答22:
just did this and it worked
HKLM > SOFTWARE > JavaSoft > Java Runtime Environment
just manually change current version to 1.7 .
lol ... but it worked!