[JIRA] (JENKINS-15812) JAVA_HOME is supperseeded by the JVM used to start the jenkins slave

286 views
Skip to first unread message

nicolas.delsaux@gmail.com (JIRA)

unread,
Nov 13, 2012, 4:55:42 AM11/13/12
to jenkinsc...@googlegroups.com
Issue Type: Bug Bug
Affects Versions: current
Assignee: Kohsuke Kawaguchi
Components: slave-setup
Created: 13/Nov/12 9:53 AM
Description:

When starting jenkins slave, used JAVA_HOME is always the java used to start the jenkins slave. In my case, it was C:\Program Files\Java\jre7.
As it's only a JRE, and not a full JDK, it didn't contain the javac executable.
As a consequence, I got

[ERROR] Unable to locate the Javac Compiler in:
C:\Program Files\Java\jre7\..\lib\tools.jar
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
In most cases you can change the location of your Java
installation by setting the JAVA_HOME environment variable.

in my maven build log.

Which allowed me to track it to the jenkins-slave.xml file.

As far as i understand, this file is used to configure how the jenkins slave is started, when run using Windows service.

So, in that file, there is this entry :

<!--
if you'd like to run Jenkins with a specific version of Java, specify a full path to java.exe.
The following value assumes that you have java in your PATH.
-->
<executable>C:\Program Files\Java\jre7\bin\java.exe</executable>

I had to change it to one full JDK to have Jenkins able to compile.
Unfortunatly, i'm quite sure Jenkins will only compile using the JDK I choose (<executable>C:\Program Files\Java\jdk1.6.0_24\bin\java.exe</executable>).

Environment: Jenkins runs on a Linux server
Jenkins slave runs on a Windows XP machine
Project: Jenkins
Labels: windows slave
Priority: Major Major
Reporter: Nicolas Delsaux
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

peterp@gmail.com (JIRA)

unread,
Dec 6, 2012, 3:18:41 PM12/6/12
to jenkinsc...@googlegroups.com
Change By: Peter Pawlowski (06/Dec/12 8:18 PM)
Summary: JAVA_HOME is  supperseeded  superseded  by the JVM used to start the jenkins slave

jamesdh@gmail.com (JIRA)

unread,
Mar 27, 2013, 5:54:54 PM3/27/13
to jenkinsc...@googlegroups.com
Change By: hardwickj (27/Mar/13 9:54 PM)
Priority: Major Critical

jamesdh@gmail.com (JIRA)

unread,
Mar 27, 2013, 5:54:53 PM3/27/13
to jenkinsc...@googlegroups.com
hardwickj commented on Bug JENKINS-15812

I'm also seeing this. The systems running our slaves have JAVA_HOME defined globally for all users to a default version of the JDK. Jenkins has multiple JDK's defined in "Manage Jenkins -> Configure System -> JDK's". Despite setting a specific version of a JDK for a given job, JAVA_HOME is still that which was used when starting Jenkins.

jamesdh@gmail.com (JIRA)

unread,
Mar 27, 2013, 6:06:53 PM3/27/13
to jenkinsc...@googlegroups.com
hardwickj commented on Bug JENKINS-15812

Yea, I added an "echo $JAVA_HOME" shell build step to verify. When running the job, this is what I see in the logs which confirms my fears:

Building remotely on build03 in workspace /data/tomcat/jenkins/workspace/Build-master
Unpacking http://macallan/sources/java/jdk-6u43-linux-x64.tar.gz to /data/tomcat/jenkins/tools/hudson.model.JDK/JDK_6u39 on build03
...
[Build-master] $ /bin/sh -xe /data/tomcat/jenkins/tmp/hudson2047019797614409905.sh
+ echo /usr/java/default
/usr/java/default

The "/usr/java/default" being the default value for $JAVA_HOME on the OS. So even though it's retrieving the correct JDK and extracting it, it's not setting JAVA_HOME to it.

The kicker is that if we don't have a default JAVA_HOME set on the host OS, then the "Default" JDK in Jenkins also never has a JAVA_HOME.

jamesdh@gmail.com (JIRA)

unread,
Mar 27, 2013, 6:08:53 PM3/27/13
to jenkinsc...@googlegroups.com
Change By: hardwickj (27/Mar/13 10:06 PM)
Priority: Critical Blocker

jamesdh@gmail.com (JIRA)

unread,
Mar 27, 2013, 6:09:53 PM3/27/13
to jenkinsc...@googlegroups.com
hardwickj commented on Bug JENKINS-15812

Oh, and we are seeing this on CentOS host OS's running our Jenkins slaves. Doesn't appear to be a windows only problem.

jamesdh@gmail.com (JIRA)

unread,
Mar 27, 2013, 6:25:53 PM3/27/13
to jenkinsc...@googlegroups.com
Change By: hardwickj (27/Mar/13 10:24 PM)
Labels: java jdk slave  windows
Priority: Blocker Major

jamesdh@gmail.com (JIRA)

unread,
Mar 27, 2013, 7:08:53 PM3/27/13
to jenkinsc...@googlegroups.com
hardwickj commented on Bug JENKINS-15812

Disregard my above statements. Our individual slave nodes had configuration settings for JAVA_HOME which were overriding everything else. <sigh/>

jamesdh@gmail.com (JIRA)

unread,
Mar 27, 2013, 7:08:53 PM3/27/13
to jenkinsc...@googlegroups.com

jamesdh@gmail.com (JIRA)

unread,
Mar 27, 2013, 7:08:53 PM3/27/13
to jenkinsc...@googlegroups.com

jamesdh@gmail.com (JIRA)

unread,
Mar 27, 2013, 7:10:53 PM3/27/13
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages