I recently built an ubuntu server that I am going to do some minor web hosting on. I have wanted to use Play Framework for a while now, so I thought this would be a good opportunity. I installed Play based on the instructions from their website, but when I get to the part that says I need to do an ant build, it fails.

The error message is as follows:

BUILD FAILED /var/www/play/framework/build.xml:67: Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not point to the JDK. It is currently set to "/usr/lib/jvm/java-6-openjdk/jre"

I am afraid that something is wrong with the way that I am setting the CLASSPATH and/or JAVA_HOME path. I have looked at a number of forum posts online, but they are all a little different which is more harm than good.

Do I need to be editing the etc/environment file? Or do I need to be editing a different file? Is there a better way to set the path for Java so that it knows where to find it?

Helpful information: When I type: ls usr/lib/jvm, I get: java-1.5.0-gcj-4.4 java-1.6.0-openjdk java-6-openjdk

I believe that the path I want for Java is `/usr/lib/jvm/java-6-openjdk/bin' but I am not really sure.

Any help with this matter would be much appreciated.

1 Answer 1


I think your problem is that you're not using the Sun version of the JDK. You can install it using the following command:

$ sudo apt-get install sun-java6-jdk

Once that is installed, the Sun version of the JDK should "supersede" the non-Sun version.

This is actually a pretty common problem. People think that the OpenJDK and GCJ versions of Java are the same as the Sun version, but a LOT of popular software just doesn't work with those non-Sun versions.

Hope that helps! If it doesn't, then type "java -version" at the command line and respond with the results.

  • GCJ is evil and should be avoided. Mar 15, 2011 at 13:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .