title: How do I change the JAVA_HOME for ant?
body: <p>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 (<code>/usr/tomcat</code> instead of <code>/usr/tomcat/jre</code> ). </p>
  
  <p>One of the things we were told to do when setting up our user accounts was to add <code>export JAVA_HOME=/usr/tomcat/jre</code> to the .bashrc file. I don't know if that was supposed to take care of the problem but it doesn't seem to.</p>
  
  <p>So, how can I change the JAVA_HOME property for ant but only for when I run ant?</p>
  
  <p>EDIT:
   <code>echo $JAVA_HOME</code> points to <code>/usr/tomcat/jre</code>
  <code>echo $JAVA_HOME\bin</code> points to <code>/usr/tomcat/jrebin</code></p>
  
  <p>The problem is when I normally run ant I get this error:</p>
  
  <pre><code>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
  </code></pre>