Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

GRAILS-7217 Auto discover of JAVA_HOME #44

Open
wants to merge 1 commit into from

2 participants

Maciej Mazur graemerocher
Maciej Mazur

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

graemerocher

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

Maciej Mazur

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

Rick Jensen cdeszaq referenced this pull request from a commit August 01, 2012
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Feb 18, 2011
GRAILS-7217 Auto discover JAVA_HOME 4de0c55
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 12 additions and 0 deletions. Show diff stats Hide diff stats

  1. 12  bin/startGrails
12  bin/startGrails
@@ -68,6 +68,18 @@ if [ -z "$JAVA_HOME" ]; then
68 68
 			
69 69
 		[ -z "$JAVA_HOME" -a -d "/System/Library/Frameworks/JavaVM.framework/Home" ] &&
70 70
 			export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home"
  71
+	else
  72
+
  73
+		javaExecutable="`which javac`"
  74
+		[ -z "$javaExecutable" -o "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ] && die "JAVA_HOME not set and cannot find javac to deduce location, please set JAVA_HOME."
  75
+		# readlink(1) is not available as standard on Solaris 10.
  76
+		readLink=`which readlink`
  77
+		[ `expr "$readLink" : '\([^ ]*\)'` = "no" ] && die "JAVA_HOME not set and readlink not available, please set JAVA_HOME."
  78
+		javaExecutable="`readlink -f \"$javaExecutable\"`"
  79
+		javaHome="`dirname \"$javaExecutable\"`"
  80
+		javaHome=`expr "$javaHome" : '\(.*\)/bin'`
  81
+		JAVA_HOME="$javaHome"
  82
+		export JAVA_HOME
71 83
 		
72 84
 	fi
73 85
 	
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.