How to run java from macOS Catalina build 10.15.4?
In 2021 the easiest way is use brew and jenv
brew install jenv openjdk@11
jenv add /usr/local/opt/openjdk@11
And then add into Intellij IDEA a new SDK with the following path:
~/.jenv/versions/11/libexec/openjdk.jdk/Contents/Home/
I will also suggest to add in your .zshrc
(or .bashrc
)
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"
export JAVA_HOME="$HOME/.jenv/versions/`jenv version-name`"
Open System Preferences -> Security and Privacy -> General
You should see a warning about Java being blocked and you can click "Allow anyway"
The next time you run java you will get a confirmation message with the option to continue: