Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5673

groovy does not detect correct Java version on Mac

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.1
    • 2.1.0
    • None
    • Mac OSX 10.8 Oracle JDK 7u6
    • Patch

    Description

      Groovy does not detect Oracle's Java 7 - instead, it will use only the Apple JDK6, unless JAVA_HOME is set.

      I'll try to get around to doing a git pull, but for now, the solution is to change startGroovy

      # Attempt to set JAVA_HOME if it's not already set.
      if [ -z "$JAVA_HOME" ] ; then
          if $darwin ; then
              jdkhome="`java -XshowSettings:properties 2>&1 | grep java\\.home | awk '{print $3}' | rev | cut -d '/' -f 2- | rev`"
              [ -d $jdkhome ] && export JAVA_HOME=$jdkhome
              [ -z "$JAVA_HOME" -a -d "/Library/Java/Home" ] && export JAVA_HOME="/Library/Java/Home"
              [ -z "$JAVA_HOME" -a -d "/System/Library/Frameworks/JavaVM.framework/Home" ] && export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home"
          else
      

      I've tested this with both the Apple and Oracle JDKs as the default, and it works correctly. My shell-fu is not strong however, and there's certainly a better way to do this.

      Attachments

        Activity

          People

            Unassigned Unassigned
            driscoll Jim Driscoll
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: