JAVA_HOME with forward slashes on Windows

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major
    • Component/s: core
    • Environment:
      Jenkins 1.596.2
      master on Linux (CentOS 6), slave on Windows (Server 2008 R2)

      When using the auto-installer to install a JDK on Windows, JAVA_HOME is set to a path with forward slashes when running a build, e.g. C:/jenkins/tools/hudson.model.JDK/JDK_1.7.0.

      That's not a problem in general, except that Groovy build steps will fail:

      [test] $ C:\jenkins\tools\hudson.plugins.groovy.GroovyInstallation\groovy-2.1.6\bin\groovy.bat C:\cms\hudson1437737400018857014.groovy
      
      ERROR: JAVA_HOME is set to an invalid directory: C:/jenkins/tools/hudson.model.JDK/JDK_1.7.0
      Please set the JAVA_HOME variable in your environment
      to match the location of your Java installation.
      Build step 'Execute Groovy script' marked build as failure
      

      groovy.bat (or more exactly startGroovy.bat) does some magic to detect and validate JAVA_HOME by searching for the value of JAVA_HOME in the output of dir %JAVA_HOME% which fails because dir normalizes the slashes to backslashes before printing them. The problem also occurs in the latest Groovy version, see https://github.com/groovy/groovy-core/blob/GROOVY_2_4_3/src/bin/startGroovy.bat#L68.

            Assignee:
            Unassigned
            Reporter:
            Daniel Spilker
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: