I'm trying to install gradle for building android app with the help of Jenkins. But I'm not able to find the link to download gradle for Centos. I tried to use binaries from https://gradle.org/downloads/, but when I unzipped I got gradle.bat file inside bin directory which tells me that this is for Windows.
Is there a place where I can download gradle for using in Jenkins?
... but when I unzipped I got gradle.bat file inside bin directory which tells me that this is for Windows.
It also contains a file called gradle, which is a shell script.
Your download is also suitable for running on any Linux or UNIX platform .... including CentOS.
Please add the GRADLE_HOME path to the PATH variable by using following steps:
echo $PATH
Copy the echoed paths and add the GRADLE_HOME path e.g.: /opt/gradle/bin to the PATH variable using a colon (:) using command: export PATH = echoed paths:GRADLE_HOME path
Now, you can use the command gradle from any path and it should work.
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?
FYI:
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;
ANT_HOME: ant path
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:
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;
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.
It's a very easy proccess
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
Type ant -v
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
I hope it will help.
Thanks,
Priya Gupta
I am using Windows 8.1 and I have installed Apache Ant and put it in my Program Files directory, but when I try:
I get:
Is there a reason why this is happening?
You need to update your PATH variable to add the path of Ant. Instructions for how to edit your PATH are here. Alternatively, you can type the full path of ant in the command.
I'm trying to use ant in a vista 64 environment to build some docbook/xml files.
However, I can't resolve this error message. Anybody have suggestions?
C:\Users\Robert Admin>ant
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\li
b\tools.jar
Buildfile: build.xml does not exist!
Build failed
Googling around, I see that this tools.jar message is the result of ant not being able to find the jdk. In fact, C:\Program Files\Java\jre6\li
b\tools.jar is a JRE installed with another program (I'm guessing). Tools.jar is located here: C:\Program Files\Java\jdk1.6.0_22\lib
I can't seem to tell Ant to look in the JDK path, only the JRE path which was already there. (Judging from the Ant documentation, it seems that JRE is insufficient).
C:\Users\Robert Admin>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.6.0_22\bin
C:\Users\Robert Admin>ant
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\li
b\tools.jar
Buildfile: build.xml does not exist!
Build failed
C:\Users\Robert Admin>echo %ANT_HOME%
I:\My Documents\1latest\ant
C:\Users\Robert Admin>where java
C:\Windows\System32\java.exe
C:\Program Files (x86)\Java\jre6\bin\java.exe
C:\Program Files\Java\jdk1.6.0_22\bin\java.exe
C:\Users\Robert Admin>java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)
Update #1. I tried uninstalling the 64 bit jdk and installing the 32 bit jdk. Result:
C:\Users\Robert Admin>java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)
C:\Users\Robert Admin>ant
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\li
b\tools.jar
Buildfile: build.xml does not exist!
Build failed
C:\Users\Robert Admin>echo %JAVA_HOME%
C:\Program Files (x86)\Java\jdk1.6.0_22\bin
I had the same problem because my JAVA_HOME path was set incorrectly (just like the OP's). It was set to the bin of the jdk.
So it was set to:
C:\Program Files (x86)\Java\jdk1.6.0_25\bin
When it should have been set to:
C:\Program Files (x86)\Java\jdk1.6.0_25
Updating this environmental variable fixed it for me.
I had this problem on a 64-bit Windows 7 machine and Ant 1.8.2. The solution was to use the admin tools mentioned by #bigfix to set the environment variables. Follow the Ant installation instructions for Windows. But do not set the path as %ANT_HOME%\bin. Instead, use an explicit path such as C:\jdk-1.5.0.05\bin.
My first test failed because my command window was already open and using the old env vars. Close it and open a new one. Then try the test. It worked for me.
I fixed this by creating JAVA_HOME in computer-> properties-> env variables
Manual setup in command line did not work
-b
I solved the problem by creating system variable JAVA_HOME to C:\Program Files\Java\jdk1.6.0_25. Don't put the semi colon after it. First of all I put the semi colon and there was an error. I removed the semi colon and it worked.
All you need is to set JAVA_HOME path in your environment. In Windows 7 go to "System Properties -> Advanced -> Environment Variables" and add JAVA_HOME. The value in my case was:
C:\Program Files\Java\jdk1.7.0_07
This resolved the issue for me. This variable points Ant to the correct Java location.
I know this thread is some what old..but i faced it just now too..what i did was copy that tools.jar into jre/lib folder and worked fine.
I'm in Windows 7 , JDK 1.7 environment and trying to install ant 1.8.2
Thanks
you may be using the java in the C:\Windows\system32 directory rather then the installed JDK. I set a JAVA_HOME environmental variable and put %JAVA_HOME%\bin at the start of my path and the problems when away.
why don't you try the 32 bit version. there could be a problem between the two versions you have installed being 32 and 64. try the 32 bit version so ur not seeing any 64 bit versions.
it should fix ur problem.
I had this issue with Environment as :
Windows 7
Java version jdk1.6.0_33
apache-ant-1.6.5
I Was getting ant build message as "Unable to locate tools.jar. Expected to find it in E:\Java\jre6\lib\tools.jar", where my JDK was installed at E:\Java\jdk1.6.0_33\ and JRE at E:\Java\jre6\
Cause:
My issue was that I have ANT_HOME was set twice in the PATH system Environment variable at two different places (means some other variables in between).
Solution:
I removed the ANT_HOME variable that pointed to the wrong location and everything worked fine with me.
I once faced the same problem of ant setup. The promotion is just the same as
Unable to locate tools.jar`. Expected to find it in C:\Program Files\Java\jre6\li b\tools.jar
Buildfile: build.xml does not exist! Build failed.
I deleted all jre path in %PATH% environment and add jdk bin path. Finally I type %ANT_PATH%/bin instead of %ANT_PATH%\bin. It works.
May help.
I got the same issue.
Successfully resolved.
Check your systeminformation that jenkins see : your_jenkins_url/systemInfo
Look for "JAVA_HOME" variable in the "Environment Variables" section. In my case I was not able to found it.
So if you do not see this variable it means that your variable was not set for the user that jenkins run under. You need to put "JAVA_HOME" in to the "system variables" section of environment variables, not "user variables".
restart jenkins after this and your problem must be fixed.
I was getting a "C:\Program" is not recognized as an internal or external command, operable program or batch file error, when running %ANT_HOME%\bin\ant.bat
I found that I needed to wrap the command in double-quotes in order to get the proper escaping to happen on the path string.
FIX:
"%ANT_HOME%\bin\ant.bat" --NOT-- %ANT_HOME%\bin\ant.bat
Hope that helps!
Thanks, this also works on Windows 8, x64, using Java x64.
I didn't want to add all that junk to my system settings so I created a batch file that I'd run just before I wanted to use the Android SDK. Here it is
set ANDROID_SDK_PT=C:\Program Files\eclipse\sdk\platform-tools
set ANDROID_SDK_TOOLS=C:\Program Files\eclipse\sdk\tools
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_25
set ANT_HOME=C:\apache-ant
set PATH=%PATH%;%ANDROID_SDK_PT%;%ANDROID_SDK_TOOLS%;%JAVA_HOME%;%ANT_HOME%\bin
I am going to add one other issue that I had with this.
BTW, the answer here worked for me too. I had to point my java directory to the specific SDK version. Thank you very much.
But I'm going to add that I had to install the SDK as an administrator, or it didn't extract tools.jar. I found this answer elsewhere, and I hope it helps someone to repeat it here.
I'm having some trouble figuring out how to install Ant on Cygwin. I want to use Ant to build Nutch. I've looked through a bunch of tutorials but I can't find anything that is low level enough for me to understand. I need something like...
Download ant, put it here
Open Cygwin
type "export ANT_HOME=..."
...
Can anyone help me out here?
Assuming you have a JDK already installed, you can do this:
$ export ANT_HOME=/cygdrive/c/apache-ant-1.7.1
which assumes you've unzipped Ant into C:\apache-ant-1.7.1. Then:
$ export PATH=$ANT_HOME/bin:$PATH
$ ant -version
Apache Ant version 1.7.1 compiled on June 27 2008
In Windows, add the path to your ant /bin directory to the Path system variable. This can easily be done by right clicking on Computer > Properties > Advanced System Settings > Environment Variables, click on Path in the System Variables, click on Edit and add ; followed by the path to your ant bin directory to the end of the Variable value.
Start or restart Cygwin.
Type ant -version The version should be displayed.
Here's a step-by-step guide:
simply download and unzip ANT binaries say into c:\apache-ant-1.8.1
download and unzip NUTCH sources say into: c:\apache-nutch-1.2
open the command prompt and run the following:
cd c:\apache-nutch-1.2
c:\apache-ant-1.8.1\bin\ant
the same would work from the Bash shell, just use Cygwin-style paths:
cd /cygdrive/c/apache-nutch-1.2
./cygdrive/c/apache-ant-1.8.1/bin/ant
That's it, you will find a new directory build containing the output.
For convenience, you might want to add the Ant bin directory to the PATH environment variable so that you don't have to give the full path each time, but that's optional.
BTW I just did those exact steps, and all went fine.
Finally, follow this tutorial to get started.