How to Change the Java Version or Switching Java (JDK) Versions on MacOS

some time, we need to install multiple JAVA versions due to system requirement and application require particular java version, e.g Hybris 2211 is compatible with java 17 but Hybris 2205 is with java 11. so we need to change java version before we start the application otherwise it will give compilation error

How to check if we have install multiple JAVA versions in Mac. Go to search icon and type “Terminal”

need to type this command on terminal “/usr/libexec/java_home -V” you will see below if you have more than java version installed.

so lets we are going to make java 1.8 to default version. need use below command.

export JAVA_HOME=`/usr/libexec/java_home -v 11.0`

command to check for current default version “java -version”

Leave a Comment

Your email address will not be published. Required fields are marked *