Skip to content

Instantly share code, notes, and snippets.

@lovejavaee
Created September 18, 2018 11:19
Show Gist options
  • Save lovejavaee/f4c6c2e219a630fff93bffbf964fa7ad to your computer and use it in GitHub Desktop.
Save lovejavaee/f4c6c2e219a630fff93bffbf964fa7ad to your computer and use it in GitHub Desktop.
#/bin/sh
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
echo $JAVA_HOME
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment