Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-15812

JAVA_HOME is superseded by the JVM used to start the jenkins slave

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • slave-setup-plugin
    • None
    • Jenkins runs on a Linux server
      Jenkins slave runs on a Windows XP machine

      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>).

            kohsuke Kohsuke Kawaguchi
            riduidel Nicolas Delsaux
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: