Skip to content

Instantly share code, notes, and snippets.

@joemaffia
Last active December 6, 2021 17:14
Show Gist options
  • Save joemaffia/8775d78ab4b883553816 to your computer and use it in GitHub Desktop.
Save joemaffia/8775d78ab4b883553816 to your computer and use it in GitHub Desktop.
Set $JAVA_HOME Environment Variable On Mac OS X
# OSX 10.5 or later Apple recommends to set the $JAVA_HOME variable to /usr/libexec/java_home
# so just export $JAVA_HOME in file ~/.bash_profile or ~/.profile or ~/.zshrc
# /usr/libexec/java_home return the Java version specified in Java Preferences for the current user.
export JAVA_HOME=$(/usr/libexec/java_home)
#specific version
#export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment