JAVA_HOME error while 'play run' on Windows -- play framework
I am getting error while doing 'play run'
"Could not execute the Java executable, please make sure the JAVA_HOME
environment variable is set properly (the Java executable should reside at JAVA_HOME/bin/java)."
But I can confirm that , JAVA_HOME
is set correctly, as I am able to run 'java' command from console i.开发者_如何学Ce. DOS prompt.
Can anyone please guide me on this?
Set user variable JAVA_HOME to C:\Progra~1\Java\jdk1.7.0_04
and
extend the system variable Path with %JAVA_HOME%\bin;
works for me
I had the same problem on Windows 7. echo %JAVA_HOME%
returned C:\Programmes\Java\jdk1.7.0
, which seemed correct. However, in Windows 7, even though path looks like that in explorer, the "real" path to use with cmd
is C:\Program Files\Java\jdk1.7.0
.
I updated JAVA_HOME
and restarted cmd
— otherwise, the terminal wouldn't refresh its variables — and it worked smoothly.
Being able to run java from your command line does NOT indicate that you have set the JAVA_HOME variable. Do you know how to do that?? Or do you know how to check if this variable exist?
Here is a quick way IF you are using Windows: Right click My Computer (or Computer in Windows 7) then click the tab Advanced then environment variables. In the System variables check if there is an entry with the variable JAVA_HOME. If NOT create one (by clicking new) giving JAVA_HOME in variable name and the path of your jdk in the variable value. IF let's say, your jdk is installed on the following path: c:\jdk6 in your pc THEN this should be your variable value. Click Ok, Ok again and then run your app again!
Have you done echo %JAVA_HOME%
?
Several issues:
JAVA_HOME
(a variable used by the JVM) is not the same thanPATH
(a variable used by the OS to locate directories where to find executables). Doingjava.exe
just shows that the bin directory of Java is in PATH, not that JAVA_HOME points where it should (or even it exists)Also, Windows usually does not use the
PATH
variable, but instead treats java specially and stores its location in the register (do anecho %PATH%
to check this).
In conclussion: You cannot assume JAVA_HOME
is set; check for it directly and set it (Control Panel-> System -> Advanced).
Make sure you use a DOS-Path in JAVA-Home. Meaning no fakes from Win-7 C:\Programme in real C:\Program Files and no blank in path.
C:\>dir /x Prog*
09.08.2011 13:55 <DIR> PROGRA~1 Program Files
21.08.2011 20:25 <DIR> PROGRA~2 Program Files (x86)
This is a safe solution.
echo %JAVA_HOME% is indeed always a good idea to.
If you have a 64 bit Windows version, make sure you have both the 32bit and 64bit version of Java installed (so there must be a Java directory in both Program Files and Program Files (x86). That was my problem.
I updated my jdk
from 1.6.0_14
to 1.7.0_10
and my jre6
to jre7
and had the same problem on XP.
I then deleted JAVA_HOME
and added it again and it worked.
I also added JRE_HOME
as a System Variable
JAVA_HOME --> C:\Program Files\Java\jdk1.7.0_10
JRE_HOME --> C:\Program Files\Java\jre7
精彩评论