Search code examples
androidantui-automationbuild.xmlandroid-uiautomator

ant build : unable to locate tools.jar. Expected find it in C:\Program Files\Java\jre7\lib\tools.jar


I know that this question is popular, but no one of solutions can help me. I used this, this, this and this solutions, but no one help me.

I want to implement uiautomator Tests and need to build my build.xml with ant, but get this strange error.

I use Windows 8.1

My JAVA_HOME system variable set to c:\programs files\java\jdk1.7.0_51 and to c:\programs files(x86)\java\jdk1.7.0_51

My PATH system variable set also to %JAVA_HOME%/bin, my %ANT_HOME% is set to c:\apache-ant.

But when I execute ant build in the android app derictory I get the

unable to locate tools.jar. Expected find it in C:\Program Files\Java\jre7\lib\tools.jar
BUILD FAILED
Perhaps JAVA_HOME does not point to the JDK

But my JAVA_HOME points to right JDK ! I confused with this. I also rebuild my build several times, I've got the same.

Will be glad if somebody help me.


Solution

  • I solved issue with setting %JAVA_HOME% to start of the PATH. It worked for me when I set it exactly to the start.