Install and Switch multiple versions of Java JDK on Linux or MacOS
While working on enterprise level, we often have java projects running on older versions of java for legacy reasons. Hence it is not very uncommon for a developer to have multiple versions of JDK installed in their machines and easy way to switch different versions of JDK on demand for running the build. This blog explains the steps needed to setup and configure multiple JDK versions on Mac OS. Get the architecture of the Machine from Terminal using: uname -m Create a directory for installation: mkdir -p $HOME/tools/java Download java binaries: Download java 25 and 21 binary for Linux / Mac OS operating system with the correct architecture type to directory $HOME/tools/java Download URL https://adoptium.net/en-GB/temurin/releases?mode=filter&os=any&arch=any Extract and rename java binaries: find $HOME/tools/java -type f -name OpenJDK25*.tar.gz | xargs -I {} mv {} $HOME/tools/java/OpenJDK25.tar.gz find $HOME/tools/java -type f -name OpenJDK21*.tar.gz | xargs -I {} mv {} $HOM...