JAVA How to JAVA Development tutorials and how to

4Mar/100

How to solve “cannot find javac” with JAVA SDK App Engine

Google App Engine Logo - JAVA How to

Recently i decided to try Google App Engine, a service where you can host your applications built in different languages like JAVA, Ruby, Python and so on, using Google's infraestructure. Now is enough for me because i see that you can get this for free:

  • 500MB storage
  • Enough CPU and bandwidth to serve your applications to 5 million visits per month

So i want to test what kind of JAVA technologies it supports (I don't know, Struts2, Spring, Hibernate JPA) . The proccess to join this is very simple, the steps are the next:

Well, i suppose that you've read the docs, build your application and you're ready to upload it. The first time that i tried to upload it i get the next error (Click to enlarge):

Bad upload App Engine - JAVA How to

It says something like "cannot find javac executable based on java.home, tried bla bla bla" , well, i read that this happens when you install JRE and then install JDK, because JDK includes JRE. java.home is the home of JRE and is not an environment variable (you can see the differences between java.home and environment variable JAVA_HOME HERE),  and i think that happens because before upload the application, it tries to compile the sources but it doesn't find javac.exe because JRE doesn't have compile tools. So, to solve it i read THIS in Google Groups and even when it doesn't work for the guy in the group it works for me. You have to modify appcfg.cmd or appcfg.sh if you're on Windows or Linux, modify this:

@java -cp ... (Windows)
java -cp ... (Linux)

To look like this:

@"C:\Program Files\Java\jdk1.6.0_16\bin\java" -cp ... (Windows)
"/usr/lib/jvm/java-6-sun/bin/java" -cp ... (Linux)

As you can see, you change java (that probably takes the value of java.home)  for the javac full path . I read that another solution is uninstall JRE and leave only JDK but i haven't tried that.

Now try again with AppCfg update your/application/path and see how your application is uploaded successfully (Click to enlarge):

Good upload App Engine - JAVA How to

You can see my application here (simple JSP with no servlets): http://myjavahost.appspot.com/

Share and Enjoy

  • Twitter
  • Facebook
  • Digg
  • del.icio.us
  • Technorati
  • MySpace
  • Sphinn
  • Print
  • Mixx
  • Google Bookmarks
  • Blogplay
  • Identi.ca
  • LinkedIn
  • Meneame
  • Netvibes
  • Yigg
  • Reddit
  • RSS
  • Tumblr
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.