links: [[Software Installation MOC]] --- # Installing adaptopenjdk using homebrew Firstly install jdk via homebrew ```sh brew install --cask adoptopenjdk ``` Now add the following function to .zshrc file to switch between different jdks ```sh jdk() { version=$1 export JAVA_HOME=$(/usr/libexec/java_home -v"$version"); java -version } ``` --- tags: #java