Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


GRAILS-7217 Auto discover of JAVA_HOME #43

wants to merge 1 commit into from

2 participants

Maciej Mazur Jeff Scott Brown
Maciej Mazur

I have extracted code that guesses JAVA_HOME from Groovy project and added it to startGrails script

Rick Jensen cdeszaq referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Jeff Scott Brown

can no longer be merged

Jeff Scott Brown jeffbrown closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 24, 2011
  1. GRAILS-7217 Auto discover JAVA_HOME

    Maciej Mazur authored
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 0 deletions.
  1. +12 −0 bin/startGrails
12 bin/startGrails
@@ -68,6 +68,18 @@ if [ -z "$JAVA_HOME" ]; then
[ -z "$JAVA_HOME" -a -d "/System/Library/Frameworks/JavaVM.framework/Home" ] &&
export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home"
+ else
+ javaExecutable="`which javac`"
+ [ -z "$javaExecutable" -o "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ] && die "JAVA_HOME not set and cannot find javac to deduce location, please set JAVA_HOME."
+ # readlink(1) is not available as standard on Solaris 10.
+ readLink=`which readlink`
+ [ `expr "$readLink" : '\([^ ]*\)'` = "no" ] && die "JAVA_HOME not set and readlink not available, please set JAVA_HOME."
+ javaExecutable="`readlink -f \"$javaExecutable\"`"
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+ JAVA_HOME="$javaHome"
+ export JAVA_HOME
Something went wrong with that request. Please try again.