1

I'm trying to build a project using ant but I keep receiving this error on issuing ant clean:

Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-7-openjdk-amd64/lib/tools.jar

I've tried to change JAVA_HOME to point to JDK and exported PATH variables, but still to no avail. Here's what they look like:

export PATH="/usr/local/heroku/bin:$PATH"

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

export PATH=$JAVA_HOME/bin:$PATH

Here's what my /etc/environment file looks like:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/$
JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"
hd1
  • 33,938
  • 5
  • 80
  • 91
robinhood91
  • 1,641
  • 3
  • 20
  • 36
  • 2
    Try with this http://stackoverflow.com/questions/5559956/ant-needs-tools-jar-and-unable-to-find-it – OscarGz Sep 22 '14 at 08:36
  • 1
    possible duplicate of [Unable to locate tools.jar](http://stackoverflow.com/questions/5730815/unable-to-locate-tools-jar) – Andrea May 12 '15 at 15:22

1 Answers1

3

As mentioned by OscarGz in the comment, you should be able to find your answer in Ant needs tools.jar and unable to find it.

Short summary: Install the JDK (Java Development Kit) with the matching version. In Debian-based systems, the package may be called openjdk-7-jdk (or later versions). You might also need to set the Java version which is actually used by invoking the update-alternatives tool for java and javac:

update-alternatives --config javac
update-alternatives --config java

Manually setting environment variables should then not be necessary.

Community
  • 1
  • 1
quazgar
  • 4,304
  • 2
  • 29
  • 41