How do I change the JAVA_HOME for ant?
- by Eugene M
I'm doing java work on a class server where I don't have root. Whenever I try to compile using ant, it points to the wrong directory (/usr/tomcat instead of /usr/tomcat/jre ).
One of the things we were told to do when setting up our user accounts was to add export JAVA_HOME=/usr/tomcat/jre to the .bashrc file. I don't know if that was supposed to take care of the problem but it doesn't seem to.
So, how can I change the JAVA_HOME property for ant but only for when I run ant?
EDIT:
echo $JAVA_HOME points to /usr/tomcat/jre
echo $JAVA_HOME\bin points to /usr/tomcat/jrebin
The problem is when I normally run ant I get this error:
Unable to locate tools.jar. Expected to find it in /usr/tomcat/lib/tools.jar
Buildfile: build.xml
compile:
[javac] Compiling 1 source file to /home/ejm244/build/classes
BUILD FAILED
/home/ejm244/build.xml:9: 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
Total time: 0 seconds