Skip to content
Advertisement

Ant unable to find javac, JAVA_HOME won’t set on Ubuntu

I have an Android Project called Hello on my Ubuntu 10.04 i386 Server (headless). It contains all things an Android project folder should have. I first build the project in bash while in the Project folder using this synax:

JavaScript

then I try to build the .apk with ant like so:

JavaScript

I get this error:

JavaScript

which is very confusing to me because just before I run ant debug I run:

JavaScript

which I know works because printenv in bash shell returns:

JavaScript

to compound this, adding this line to my /etc/environment file

JavaScript

does not fix the problem either – I get the same error. Nothing I do changes the fact Ubunut still thinks /usr/lib/jvm/java-6-openjdk/jre is the JAVA_HOME. What is going wrong? I’ve been at this for too many hours.

Advertisement

Answer

Did you install the JDK?

When you install Ubuntu only the JRE is installed as part of the default packages. Unfortunately Ubuntu’s package management names the directory as if the JRE were installed along with the JDK. The directory is named java-6-openjdk even though the JDK is not be present.

Do the following:

JavaScript

It will install the JDK in that same directory.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement