0
votes

I am using windows 8 java installed in Program files. I am getting such error "Unable to locate tools.jar. Expected to find it in C:\Program Files (x86)\Java\jre1.8.0_40\lib\tools.jar"

After creating 2 system variables as"JAVA_HOME" with the path 'C:\Program Files\Java\jdk1.8.0_40' and "ANT_HOME" with the path 'D:\Software\apache-ant-1.9.4'. Then, I set the path variable to %JAVA_HOME%\bin; and ant variable to %ANT_HOME%\bin.

Still getting the same error as "Unable to locate tools.jar".

Also, I have tried by copy/pasting tools.jar from JDK lib to JRE lib folder. but had no luck. Getting the same error

2
Am I wrong, or tools.jar cames with JDK, not JRE?Antoniossss
@Antoniossss You are absolutely correct.nom
+ quality assurence .....Antoniossss
@NabeelOmer That is rude to say, many people being new on some technology might face such simple errors. Besides this question has been asked before on SO community and also ANT is an build process automation tool , so this is the correct platform to ask the question.Mustafa sabir

2 Answers

0
votes

For development purposes like compilation (javac) you will be needing a JDK. Since you get that error it means you might be running some functionality that uses JDK. Hence you will have to point to a JDK. Also ANT documentation recommends using JDK for full support of ANT features.

Note: If a JDK is not present, only the JRE runtime, then many tasks will not work.

Also looking at your question

I have tried by copy/pasting tools.jar from JDK lib to JRE lib folder ?

This is not a recommended approach you will need a full JDK. JDK has many things other than JRE + tools.jar

0
votes

Hi same error was created by my system,but i am copy the tools.jar file and past in the jre/lib folder...that problem has been solved