Skip to content

Instantly share code, notes, and snippets.

@tfnico
Created August 26, 2014 09:03
Show Gist options
  • Save tfnico/5fd2dfea556d9a357a55 to your computer and use it in GitHub Desktop.
Save tfnico/5fd2dfea556d9a357a55 to your computer and use it in GitHub Desktop.
Set JAVA_HOME to whatever jenv says it is on OS X
#In my .zshrc:
#...
# Normal jenv config
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"
# Now find the JAVA_HOME for it:
jenv_java=$(jenv global) # yields 'oracle64-1.6.0.54'
echo $jenv_java
jenv_java_without_oracle=${jenv_java#*oracle64-} # yields '1.6.0.54'
echo $jenv_java_without_oracle
export JAVA_HOME=$(/usr/libexec/java_home -v "$jenv_java_without_oracle")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment