Quality Testing

Quality is delighting customers

Selenium - Ant - Junit - ANT unable to find the tools.jar !!!


I am trying to use ant with eclipse(Juno). 

When i run the "ant compile" command then i get the following error:

E:\WebDriver\WorkSpace\JUnitDemo1>ant compile
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre7\li
Buildfile: E:\WebDriver\WorkSpace\JUnitDemo1\build.xml



[delete] Deleting directory E:\WebDriver\WorkSpace\JUnitDemo1\build

[echo] making directory...
[mkdir] Created dir: E:\WebDriver\WorkSpace\JUnitDemo1\build
[echo] classpath------: E:\WebDriver\selenium-server-standalone-2.25.0.jar
[echo] compiling...

E:\WebDriver\WorkSpace\JUnitDemo1\build.xml:80: 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\jre7"

Total time: 0 seconds

following are the environment variables:
Classpath ==> C:\Program Files\Java\jdk1.7.0_10\lib;E:\WebDriver\apache-ant-1.8.4-bin\apache-ant-1.8.4\lib;

path==>c:\Program Files (x86)\AMD APP\bin\x86_64;c:\Program Files (x86)\AMD APP\bin\x86;c:\Program Files (x86)\Intel\iCLS Client\;c:\Program Files\Intel\iCLS Client\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Windows Live\Shared;C:\ANT\apache-ant-1.8.4-bin\apache-ant-1.8.4\bin;C:\Program Files\Java\jdk1.7.0_10\bin;

JAVA_HOME ==>  C:\Program Files\Java\jdk1.7.0_10;

I am using Windows 8 64 bit

I even tried adding tools.jar in ANT>Runtime preferences in eclipse, but still getting the same error

But it works the moment i paste the tools.jar file in the jre folder. BUT IS THIS THE ROGHT WAY TO DO IT????

I have attached the build.xml in case if that is needed.


Views: 575


Reply to This

Replies to This Discussion

Have you tried after removing semicolon from  JAVA_HOME ==>  C:\Program Files\Java\jdk1.7.0_10;

also set ANT_HOME= ant bin directory if not already set

IT WORKED !!!!!! :) Thanks a lot  Sandeep !!! i could never guess that the solution lied in a small semi-colon !!!!

But can somebody explain how that makes the difference . :)

Did u perform this step ?

jdk1.7.0  > lib > tools.jar  (copy this)

jre7 or 6 > lib  > paste tools.jar

And Path name you should be given the System properties > Environment variables > (name and Path should mention )

Click on path and add ;(semicolon) and path of ANT location with /bin.

And try.

Thanks  Pavithra for the quick reply.

And yes, as i have written above, If i paste the tools.jar file in the jre folder then it works fine. BUT is it the right way to do it? 


TTWT Magazine





© 2021   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service