As of 2023, brew install --cask zulu8 didn't work for me on Apple chip. brew install openjdk@8 also didn't not. The only one solution worked for me was brew install --cask adoptopenjdk8 and then of course vim ~/.zshrc with export JAVA_HOME=JAVAC_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/ inside that file.