diff options
| author | mo khan <mo.khan@gmail.com> | 2020-04-16 19:38:47 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-04-16 19:38:47 -0600 |
| commit | 8c6d89562017bad18333269a296523c0cad28885 (patch) | |
| tree | 8b6adfea5b6d542d94189841e40c7b5766358c88 /config | |
| parent | 43c4a1c7ba355d42e717f61bcc7b71a317d9c5b3 (diff) | |
Update JAVA_HOME
Diffstat (limited to 'config')
| -rw-r--r-- | config/.bashrc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/config/.bashrc b/config/.bashrc index cd1dc74..9c463dd 100644 --- a/config/.bashrc +++ b/config/.bashrc @@ -11,6 +11,15 @@ function inflate() { fi } +update_java_home() { + local java_path + java_path="$(asdf which java)" + if [[ -n "${java_path}" ]]; then + export JAVA_HOME + JAVA_HOME="$(dirname "$(dirname "$(realpath "${java_path}")")")" + fi +} + function switch_to() { local tool=$1 local major_version=$2 @@ -19,8 +28,7 @@ function switch_to() { asdf shell "$tool" "$version" if [[ "$tool" = "java" ]]; then - JAVA_HOME="$(asdf which java)" - export JAVA_HOME + update_java_home fi } |
