Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

GRAILS-7217 Auto discover of JAVA_HOME #44

Closed
wants to merge 1 commit into from

3 participants

@mamciek

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

@graemerocher
Owner

Which unix environments (other than Mac OS X) has this been tested on?

@mamciek

I have personally tested it on Ubuntu 10.10 and Debian Squeeze (and it works). I assume that it was tested on more environments by folks from Groovy project

@cdeszaq cdeszaq referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@lhotari
Collaborator

Closing outdated pull requests.

@lhotari lhotari closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 18, 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
View
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
fi
Something went wrong with that request. Please try again.