views:

240

answers:

6

I am trying to upload my GAE app using the console in windows. I am getting the error:

cannot find javac executable based on java.home tried, "C:\Program Files\Java\jre6\bin\javac.exe" and "C:\Program Files\Java\bi n\javac.exe"

Unable to upload app: cannot find javac executable based on java.home, tried "C: \Program Files\Java\jre6\bin\javac.exe" and "C:\Program Files\Java\bin\javac.exe

javac.exe is located in C:\Program Files\Java\jdk1.6.0_18\bin how do I tell java thats where it is

+2  A: 

The error message makes it clear that the lookup is based on java.home, have you tried adjusting that?

This output looks like it is coming from some sort of script which may have it's own definition of java.home which you need to change.

matt b
java.home # java/lang/System % getProperty )Ljava/lang/String; <---That is in the jar file i am running the script from. Is it safe to change that line or should I change it somewhere else?
Lumpy
A: 

Set your JAVA_HOME environment variable to C:\Program Files\Java\jdk1.6.0_18. Note that this variable points to the JDK location, not (unlike the PATH environment variable) to the path where the executables reside.

Joey
+4  A: 

You must set the JAVA_HOME environment variable to refer to the top-level folder where java is installed. Right-click "My Computer", Properties, Advanced, Environment Variables. If there's an existing JAVA_HOME variable, then correct it so that its value is

C:\Program Files\Java\jdk1.6.0_18

If there is no existing variable, then create one by using the "New" button. It's up to you whether to do it for the current user or for the system.

Jonathan Feinberg
+1 for providing directions on how to set the variable
Dancrumb
I added both java.home and JAVA_HOME with C:\Program Files\Java\jdk1.6.0_18 and I am still getting the same error. Could this value be kept somewhere else
Lumpy
see my answer below, it's possible whatever script you are running has it's own interpretation of "java.home" and does not use the environment variables
matt b
+1  A: 

The other way you can do set classpath variable using set CLASSPATH=C:\Program Files\Java\jre6\bin\javac.exe\jdk1.6.0_18 in command prompt, but it works for single session.Everytime you need to set the variable.

giri
so I should set java.home = classpath? or set java.home=C:\Program Files\Java\jre6\bin\javac.exe\jdk1.6.0_18. Neither work.
Lumpy
+1  A: 

Do you have two java versions installed?
From the information the sun jre and the Open jdk? The jre has no javac.exe and therefore cant find it.
Try to start your jar with C:\Program Files\Java\jdk1.6.0_18\bin\java.exe instead of only java, if that doesn't help add the -Djava.home="C:\Program Files\Java\jdk1.6.0_18" option to the call.

josefx
A: 

The easiest solution for this problem which I found is to use the JAVA_HOME variable in the script file.

This is the content of my bin\appcfg.cmd:

@"%JAVA_HOME%"\bin\java -cp "%~dp0\..\lib\appengine-tools-api.jar" com.google.appengine.tools.admin.AppCfg %*

Note: you should also check if JAVA_HOME points to an existing JDK

mjustin