Ant/Ubuntu/Eclipse JAVA_HOME

1.3k views Asked by At

I have a problem when trying to compile a project with ant, whose build file was generated through Eclipse. At work I am running Debian and everything works just fine, also in the server.

However at home I have Ubuntu and when I try to compile I get the following error.

JAVA_HOME does not point to the JDK.

It is currently set to "/usr/lib/jvm/java-7-openjdk-amd64/jre"

So I edited my bashrc with the following lines

export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64

export PATH=$PATH:$JAVA_HOME/bin

I restart my bashrc and I test

echo $JAVA_HOME

/usr/lib/jvm/java-7-openjdk-amd64

fine, then I try to compile again but the error persists.

Perhaps JAVA_HOME does not point to the JDK.

It is currently set to "/usr/lib/jvm/java-7-openjdk-amd64/jre"

Any idea on how to solve this? Ideally since the project is running on multiple machines, any change should be local.

thanks in advance

2

There are 2 answers

0
Altober On

Ok, I am not sure this will help anyone but this is what I did. After going nuts I removed all java versions I had (6 and 7) and ant and installed them again (ant, jav 6 and java 7). Now it works.

5
Wintermute On

Try export PATH=$JAVA_HOME/bin:$PATH to have your JDK Path before the existing ones.