Skip to content

Instantly share code, notes, and snippets.

@bizenn
Created June 13, 2014 07:56
Show Gist options
  • Save bizenn/6235bab71ebd3bb86b3f to your computer and use it in GitHub Desktop.
Save bizenn/6235bab71ebd3bb86b3f to your computer and use it in GitHub Desktop.
--- apache-maven-3.2.1.ORIG/bin/mvn 2014-02-15 02:40:05.000000000 +0900
+++ apache-maven-3.2.1/bin/mvn 2014-06-13 16:37:15.000000000 +0900
@@ -133,16 +133,21 @@
fi
if [ -z "$JAVA_HOME" ]; then
- javaExecutable="`which javac`"
- if [ -n "$javaExecutable" -a ! "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
- # readlink(1) is not available as standard on Solaris 10.
- readLink=`which readlink`
- if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
- javaExecutable="`readlink -f \"$javaExecutable\"`"
- javaHome="`dirname \"$javaExecutable\"`"
- javaHome=`expr "$javaHome" : '\(.*\)/bin'`
- JAVA_HOME="$javaHome"
- export JAVA_HOME
+ if [ -x /usr/libexec/java_home ]; then
+ JAVA_HOME=`/usr/libexec/java_home`
+ export JAVA_HOME
+ else
+ javaExecutable="`which javac`"
+ if [ -n "$javaExecutable" -a ! "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
+ # readlink(1) is not available as standard on Solaris 10.
+ readLink=`which readlink`
+ if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+ javaExecutable="`readlink \"$javaExecutable\"`"
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+ JAVA_HOME="$javaHome"
+ export JAVA_HOME
+ fi
fi
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment