Solution:
- MacOS versions before Big Sur: add line
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home/
to.bash_profile
file in your home directory. Runsource ~/.bash_profile
to update terminal. - Catalina, Big Sur, Mentere and above: add line
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/Contents/Home
to.zshenv
file in your home directory. Runsource ~/.zshenv
to update terminal.
After that, running java -version
gave this output and Java started to execute normally:
openjdk version "1.8.0_112-release"
OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
OpenJDK 64-Bit Server VM (build 25.112-b06, mixed mode)
As for the Android Device Monitor — it still demands this ancient JRE version 6.