1

I was trying out ant -version after installing ant and I get this:

Unable to locate tools.jar. Expected to find it in C:\Program Files\JRE\jre7\lib
\tools.jar
Apache Ant(TM) version 1.9.2 compiled on July 8 2013

I have also installed JDK under C:\Program Files\Java\jdk1.7.0_25 and JRE under C:\Program Files\JRE\jre7. I have also added jdk and ant bin path in the environmental path PATH. Not sure what else needs to be done!

Mercenary
  • 2,106
  • 6
  • 34
  • 43

2 Answers2

6

Check your environment variables. JAVA_HOME must point to the jdk root, while Path must contain %JAVA_HOME%/bin. A jre does not contain tools.jar, so you have to point it to a jdk.

Don't forget to also check %ANT_HOME%, but since it's already looking for tools.jar, I assume it's already configured correctly.

fcm
  • 6,305
  • 5
  • 24
  • 37
  • OH! I was under the assumption that you actually dont need JAVA_HOME and you can directly give the path in PATH without giving %JAVA_HONE%. Eclipse worked fine with this though!! – Mercenary Jul 23 '13 at 12:54
3

A JRE doesn't have a tools.jar, you need a JDK. Set your JAVA_HOME and PATH variables, so that they point to a JDK, not a JRE.

Ankur Lathi
  • 7,636
  • 5
  • 37
  • 49