Skip to content

Commit

Permalink
Update java.zsh
Browse files Browse the repository at this point in the history
homebrew/cask-versions was deprecated
add java17
  • Loading branch information
blendthink authored Jul 6, 2024
1 parent 5ed956f commit e6e9364
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scripts/java.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ if [[ $(uname -m) == 'arm64' ]]; then
sudo softwareupdate --install-rosetta --agree-to-license
fi

brew tap homebrew/cask-versions
brew install --cask \
temurin8 \
temurin11
temurin@8 \
temurin@11 \
temurin@17

if grep -q '# java path' "$HOME/.zshrc" &>/dev/null; then
echo "java path is already setting ✅ "
Expand All @@ -23,12 +23,15 @@ else
# java path
JAVA_8_HOME=$(/usr/libexec/java_home -v 1.8)
JAVA_11_HOME=$(/usr/libexec/java_home -v 11)
JAVA_17_HOME=$(/usr/libexec/java_home -v 17)
export JAVA_8_HOME
export JAVA_11_HOME
export JAVA_17_HOME
alias java8='export JAVA_HOME=$JAVA_8_HOME ; PATH="${JAVA_HOME}/bin:${PATH}"'
alias java11='export JAVA_HOME=$JAVA_11_HOME ; PATH="${JAVA_HOME}/bin:${PATH}"'
alias java17='export JAVA_HOME=$JAVA_17_HOME ; PATH="${JAVA_HOME}/bin:${PATH}"'
EOF
fi
echo "Completed setting java path ✅ "
Expand Down

0 comments on commit e6e9364

Please sign in to comment.