MakD
MakD

Reputation: 1

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.e. DOS prompt.

Can anyone please guide me on this?

Upvotes: 0

Views: 4886

Answers (8)

Alison Iuri
Alison Iuri

Reputation: 336

Probably overdated here, but in my case, I had to edit the play.bat and set JAVA_HOME path:

@echo off
set "JAVA_HOME=JAVA_HOME=C:\Program Files (x86)\Java\jre1.8"
"%~dp0python\python.exe" "%~dp0play" %*

Hope it helps.

Upvotes: 0

Jim Kat
Jim Kat

Reputation: 21

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

Upvotes: 0

Razzie
Razzie

Reputation: 31232

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.

Upvotes: 0

NFpeter
NFpeter

Reputation: 613

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

Upvotes: 3

deluxouss
deluxouss

Reputation: 21

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.

Upvotes: 1

niels
niels

Reputation: 7309

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.

Upvotes: 0

SJuan76
SJuan76

Reputation: 24895

Have you done echo %JAVA_HOME%?

Several issues:

  • JAVA_HOME (a variable used by the JVM) is not the same than PATH (a variable used by the OS to locate directories where to find executables). Doing java.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 an echo %PATH% to check this).

In conclussion: You cannot assume JAVA_HOME is set; check for it directly and set it (Control Panel-> System -> Advanced).

Upvotes: 0

gred
gred

Reputation: 537

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!

Upvotes: 0

Related Questions