Error while running ant compile | Selenium Forum
G
gautam Posted on 26/10/2020

Hi,

I am getting below error when i execute ant compile:

 

C:\Users\Gautam\eclipse-workspace\JunitProject1>ant compile
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.8.0_261\lib\tools.jar
Buildfile: C:\Users\Gautam\eclipse-workspace\JunitProject1\build.xml

setClassPath:

init:

clean:
[delete] Deleting directory C:\Users\Gautam\eclipse-workspace\JunitProject1\build

compile:
[echo] making directory...
[mkdir] Created dir: C:\Users\Gautam\eclipse-workspace\JunitProject1\build
[echo] classpath------: C:\Temp\org.hamcrest.core_1.3.0.v20180420-1519.jar:C:\Temp\org.junit_4.13.0.v20200204-1500.jar
[echo] compiling...
[javac] C:\Users\Gautam\eclipse-workspace\JunitProject1\build.xml:79: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds

BUILD FAILED
C:\Users\Gautam\eclipse-workspace\JunitProject1\build.xml:79: 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.
It is currently set to "C:\Program Files\Java\jre1.8.0_261"


A
Ashish Replied on 27/10/2020

Copy C:\Program Files\Java\jdk1.8.\lib\tools.jar to C:\Program Files\Java\jre8\lib\

and try

 

If itsnot working then point Java home to jdk folder


S
shakthipriyaa Replied on 28/10/2020

I got the same error. And the above solution worked for me. Thanks,


Related Posts