Failed ANT build: Unable to locate tools.jar

60 views
Skip to first unread message

ABostonGal ABostonGal

unread,
Jun 7, 2019, 10:48:58 AM6/7/19
to Jenkins Users
I have an ANT build that has been working just fine for quite a while and suddenly it has stopped working and I am trying to figure out why. Here is what the Jenkins console displays and my notes about it. I've obscure the actual site name, directory values, and Jenkins job name, etc. "uvwx" is the Jenkins job that is failing to build

In Jenkins console:

No changes for svn://ab/cd/ef/gh/ijk since the previous build

Copied 3 artifacts from "lmnop" build number 137

Copied 2 artifacts from "qrst" build number 2700

[uvwx] $ cmd.exe /C "C:\Users\jenkins\jenkins_home\tools\hudson.tasks.Ant_AntInstallation\Ant_1.9.6\bin\ant.bat get-revision compile-tests compile-javadoc package-jar package-javadoc && exit %%ERRORLEVEL%%"
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.8.0_201\lib\tools.jar


My notes about this: 

What I want to know is: WHY does the build "expect" to find it in "c:\Program Files\Java\jre1.8.0_201"? There IS no such path on the machine on which the job is building...

How can I find out WHERE that value is coming from? I've been looking at the ant, build files and source code and don't see where that value would be set.

Thank you.


Mark Waite

unread,
Jun 7, 2019, 2:24:55 PM6/7/19
to Jenkins Users
I suspect that something (Jenkins tool definition, local setting on the computer, etc.) is defining a JAVA_HOME environment variable as  c:\Program Files\Java\jre1.8.0_201.

Add a bat step to the job prior to calling `ant` and run the command `set`.  That will report the environment variable to confirm the guess that something is placing value that into the environment.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/794e1399-0d52-42d9-b805-0e197667d3c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Thanks!
Mark Waite

ABostonGal ABostonGal

unread,
Jun 7, 2019, 2:44:13 PM6/7/19
to Jenkins Users
Thank you Mark. Yes, I checked for that the Environment Variables but unfortunately: nothing! I've tried adding a JAVA_HOME variable pointing to the place where the tools.jar is and the build failed.
I'd really like to understand how the build files "think" they should be looking for this before I do anymore "experimenting"...

Mark Waite

unread,
Jun 7, 2019, 3:08:20 PM6/7/19
to Jenkins Users
Most interesting.

Ant expects to have a full JDK available.  It depends on the tools.jar file which is provided by the JDK but is not available with the JRE.  The directory name "jre1.8.0_201" indicates that it is not a JDK, but a JRE.  You indicated that even that directory does not exist on the agent running the build.  It might also indicate that the job is running on a Windows agent that has the Oracle script in its path which attempts to dynamically determine the path to the Java program.

The path that is being used to run ant indicates that you have a Jenkins build tool defined for Ant 1.9.6.  That may indicate you also have a JDK tool defined for JRE 1.8.0_201.  The Jenkins tool definitions are available from the "Configure System" page and might help detect the source of the jre1.8.0_201 setting.

Best of luck!
Mark Waite

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
Thanks!
Mark Waite

ABostonGal ABostonGal

unread,
Jun 7, 2019, 3:27:47 PM6/7/19
to Jenkins Users
Thank you Mark. Ya' I've been looking all over the place...there is one file referenced that looks promising, but for the life of me, I cannot find it either!

build.properties

Here's where I saw it in the build.xml:
<!-- Load properties, starting with highest priority. -->
<!-- Custom user (development) properties -->
<property file="${user.home}/.ant/${ant.project.name}.properties" />
<!-- ToDo: Check these, lower priority? -->
<property file="${user.home}/.ant/build.properties" />
<property file="${basedir}/conf/${system.host.name}/build.properties" />

but from the comments in the above...maybe it does not exist...



To unsubscribe from this group and stop receiving emails from it, send an email to jenkins...@googlegroups.com.


--
Thanks!
Mark Waite
Reply all
Reply to author
Forward
0 new messages