- Unable to locate tools.jar [duplicate]
- Unable to locate tools.jar [duplicate]
- YouTube
- Why do I see «Unable to locate tools.jar. Expected to find it in . » when I run ant (on RHEL 6.6) even though the path is set
- Unable to locate tools.jar. Proper solution?
- Ant build : unable to locate tools.jar. Expected find it in C:\Program Files\Java\jre7\lib\tools.jar
Unable to locate tools.jar [duplicate]
In Environment variable->System variables , I have defined: JAVA_HOME: C:\Program Files\Java\jdk1.8.0_31; ANT_HOME: ant path In order to work properly I had to setup my environmental variables with following extra paths: In Environment variable->User variables , I have defined: SVN_PATH : C:\Program Files\TortoiseSVN ANDROID_HOME : C:\Program Files\adt-bundle-windows\sdk Inside Environment variable->System variables : in the Path added the following paths: C:\ProgramFiles\TortoiseSVN\bin; C:\Program Files\adt-bundle-windows\sdk\platform-tools; C:\Program Files\adt-bundle-windows\sdk\tools; %ANDRIOD_HOME%\platform-tools; %ANDRIOD_HOME%\tools; %SVN_PATH%\bin; C:\Program Files\SlikSvn\bin;
Unable to locate tools.jar [duplicate]
I’m trying to use ant to compile using this command :
I don’t know if the problem comes from my windows 64bit, or by something else. Because I have java Installed in the 64 & 32 prog files.
I downloaded apache-ant-1.8.2-bin and putted it in C:\Program Files\apache-ant-1.8.2
I tried to put ant everywhere, I switched also the ENV PATH between java 64 and 32 but everytime I get this error message :
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\lib\tools.jar
I searched for tools.jar in the ant lib folder, in the java 64 and 32, but no trace of it in the system.
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.
I had similar issue and got solved by doing following ,
1) set JAVA_HOME as C:\Program Files (x86)\Java\jdk1.7.0\
2) ANT_HOME as F:\ant\apache-ant-1.8.4-bin\apache-ant-1.8.4
3) add both to ‘path ‘ in system variables
Please make sure that you are pointing to JDK and not a JRE. For example, you should set JAVA_HOME as «C:\Program Files\java\jdk1.6.0_26» and have %JAVA_HOME%\bin in your system path.
I had to copy C:\Program Files\Java\jdk1.6.0_26\lib\tools.jar to C:\Program Files\Java\jre6\lib\ext
Unable to locate tools.jar for Java SE 14, If your code is checking for the existence of tools.jar, remove the check and (if necessary) check a different way. If the dependency is in third-party code (probably a tool) you need to upgrade it to a version that is compatible with the version of Java that you are trying to use. Share edited May 20, 2021 at …
YouTube
Why do I see «Unable to locate tools.jar. Expected to find it in . » when I run ant (on RHEL 6.6) even though the path is set
I created a script in /etc/profile.d and named it jdk_home.sh . The contents of jdk_home.sh are as follows :
#!/bin/sh export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::") export PATH=$JAVA_HOME/bin:$PATH
(I followed an answer of this question on Stack Overflow to set up $JAVA_HOME).
I then typed source /etc/profile.d/jdk_home.sh on the command line. After that, I typed echo $JAVA_HOME and it gave me the following output:
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131.x86_64
After I typed echo $PATH I got this output:
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131.x86_64/bin:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131.x86_64/bin:/bin:/bin:/bin:/bin:/bin:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el6_8.x86_64/bin:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121/bin:/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin:/bin:/usr/apache/apache-ant-1.9.9/bin:/bin:/bin:/bin:/bin:/bin:/bin
I then opened another terminal in a project folder I named dal . I put build.xml in that folder. My build.xml has the following contents:
Hello World - Welcome to Apache Ant!
I typed ant there on the command line:
This produced the following output:
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el6_8.x86_64/lib/tools.jar Buildfile: /root/Desktop/dal/build.xml info: [echo] Hello World - Welcome to Apache Ant! BUILD SUCCESSFUL Total time: 0 seconds
Why am I seeing the tools.jar warning? Doesn’t the path contain the required information?
I later discovered that tools.jar wasn’t in the jdk directory. I ran the command yum install java-1.8.0-openjdk-devel and lib/tools.jar became available in the java folder. When I ran the ant command after this, I did not get the same warning.
Android — Unable to locate tools.jar Fedora, The first command tells me what Java I’m using (1.7.0, since 1.8.0 is another option) and the second command asks it to install the development libraries, which includes tools.jar, among other things. But I should add that my /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.7.0.fc20.x86_64 directory does …
Unable to locate tools.jar. Proper solution?
I have find so many question related to this in SO.
When i type ant -version in the command prompt, the following is printed:
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.8\lib tools.jar
Apache Ant version 1.9.4 compiled on April 29 2014
Even though it is saying «Unable to locate tools.jar. » it is also printing the version number.
All the other solutions didn’t work EXCEPT copying the tools.jar from:
C:\Program Files\Java\jdk1.8.0_31\lib and paste it in
C:\Program Files\Java\jre1.8.0_31\lib
After this, when i typed ant -version , only Apache Ant version 1.9.4 compiled on April 29 2014 is diplayed.
Is this solution recommeded?
Before installing jdk 1.8, I had jdk 1.7 and jre 1.8 already installed separately. Now I have all the three inside the same folder C:\Program Files\Java .
In Environment variable->System variables , I have defined:
JAVA_HOME: C:\Program Files\Java\jdk1.8.0_31;
And in the PATH included C:\Program Files\Java\jdk1.8.0_31\bin; and ant bin path also.
By setting the following Environmental variables as below, my issue was resolved:
In Environment variable->User variables , I have defined:
ANT_HOME: C:\Program Files\apache-ant-1.9.4
In Environment variable->System variables , I have defined: JAVA_HOME: C:\Program Files\Java\jdk1.8.0_31;
And in the Path added the following things: C:\Program Files\Java\jdk1.8.0_31\lib;C:\Program Files\Java\jdk1.8.0_31\bin;
In my case I was trying some ant script with adb and svn and I don’t know whether they were related or not. Because my ADT bundle was in Desktop, so I had to put it inside C drive.
In order to work properly I had to setup my environmental variables with following extra paths:
In Environment variable->User variables , I have defined:
SVN_PATH : C:\Program Files\TortoiseSVN
ANDROID_HOME : C:\Program Files\adt-bundle-windows\sdk
Inside Environment variable->System variables :
in the Path added the following paths:
Are you sure that the PATH variable contains only one Java path? This may be linked to java defined twice on your PATH (with the secon being JRE location).
I had exaclty the same problem in eclipse (which should look for JDK rather than JRE), and the solution was to just manually configure java location in eclipse.
Copy tools.jar from JDK lib folder & paste it in JRE lib folder . Just Make sure JDK & JRE installed on your C drive and point their paths in Environment settings.
Once it is done. Open Command Prompt
If You get below messages then ANT is installed successfully
c:>ant -v Apache Ant(TM) version 1.10.1 compiled on February 2 2017
Java — Maven unable to locate Javac Compiler, C:\Development\java jre7\..\lib\tools.jar Do you have a JDK installed? If so, change your JAVA_HOME to point to the JDK instead. If not, download the JDK first and then set JAVA_HOME. Update. Since you’re running from inside Eclipse your answer is on SO — you need to tell Eclipse to use the JDK and not the JRE.
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.
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.
I too had this problem and solved it by setting variables like this :
[1] ANT_HOME - C:\apache-ant-1.9.3 [2] JAVA_HOME - C:\Program Files\Java\jdk1.7.0_21 [3] PATH - D:\Android_Development\android_sdk\platform-tools\;%ANT_HOME%\bin;%JAVA_HOME%\bin;D:\Android_Development\android_sdk\tools
Note : Set all these in System variables not in user variables.
To Recover this problems you can just copy the tools.jar from «C:\ProgramFiles\Java\jdk1.7.0\lib» directly into «C:\Program Files\Java\jre7\lib\».You will successfully recover the problems.
I solved issue with setting %JAVA_HOME% to start of the PATH. It worked for me when I set it exactly to the start.
In regards to the tools.jar , I experienced the following: when downloading ant, it came with open java 7. However, the system I had downloaded, uses Java 8 u 40 (the Oracle version). Therefore, when I pointed the lib/jre via a softlink in linux, to the place of the tools.jar , I got the error, that now the version/subversion was not matching. This because ant was using version 7, and the tools.jar from Oracle was now version 8.
The solution was, to use the above help (with the setting of the JAVA_PATH to become my Oracle version 8u40 of Java), such that both the compiler and the tools.jar file is of same version.
The scenario I am in, therefore has the jdk downloaded as it came from Oracle in my /home/david/Desktop/Android5.0/jdk1.8.0u40 directory — the Android packages as they came in /home/david/Desktop/Android5.0 directory, my Eclipse workspace in /home/david/workspace — and now I hope to be better to go.
The ant-file build.xml is placed in my /home/david/workspace directory — and it is looking like this:
The java file in this question — HelloWorld.java, is being put into the directory /home/david/workspace/build/src/oata — and it now compiles to its destination you can see above, and from there the jar file is being built too.
True — there are methods where one can make one version of Java pretend to be another — but I didn’t want to go there, because I am setting up a build environment where I can do extracts from the repository, build, and storing of the built code into a download site.
The above build.xml sample is slightly modified from the following Ant tutorial for build: https://ant.apache.org/manual/tutorial-HelloWorldWithAnt.html
Guys — hope it works for you too, because ant is really one of the best ways of building, as you can invoke it from the command line, you can make it pick files from the repository first (GitHub or BitBucket etc.), and then you can FTP the compiled result to your preferred download site for developers, you can zip together the code such that you have the version ready and zipped in worst case.
Java — Ant needs tools.jar and unable to find it, I am putting together a dev environment for a Java program and after the first try of my Ant build scripts I got this error: Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-