Follow the below steps to install OpenJDK
1. Make sure you installed brew in mac( if not follow this https://brew.sh/)
2. After install brew, execute the below commands
$ brew tap AdoptOpenJDK/openjdk
$ brew cask install adoptopenjdk11
$ java -version
3. If proper java version is not displayed then set the Path of OpenJDK in JAVA_HOME do the below steps. Usually java installation will be on "/Library/Java/JavaVirtualMachines/" choose your version and set the JAVA_HOME
$ export JAVA_HOME = /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
$ java -version