Skip to content

Instantly share code, notes, and snippets.

@clairtonluz
Created April 20, 2021 18:19
Show Gist options
  • Save clairtonluz/3de8722ebdf5ed4e11291fe174ee73cb to your computer and use it in GitHub Desktop.
Save clairtonluz/3de8722ebdf5ed4e11291fe174ee73cb to your computer and use it in GitHub Desktop.
# set JAVA_HOME on every change directory while using asdf-vm
function asdf_update_java_home {
asdf current java 2>&1 > /dev/null
if [[ "$?" -eq 0 ]]
then
export JAVA_HOME=$(asdf where java)
fi
}
precmd() { asdf_update_java_home; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment