Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run java from macOS Catalina build 10.15.4?

I just upgraded my macOS Catalina from 10.15.3 -> 10.15.4 and I cannot run java in IntelliJ anymore.

I managed to get it working from Terminal by applying caveats from brew:

➜  ~ brew reinstall java
==> Reinstalling openjdk 
==> Downloading https://homebrew.bintray.com/bottles/openjdk-13.0.2+8_2.catalina.bottle.tar.gz
Already downloaded: /Users/jactor/Library/Caches/Homebrew/downloads/0dd8815aa4758e78a47b642bf541e2ada54d5067a8742b33b309989b77d0741b--openjdk-13.0.2+8_2.catalina.bottle.tar.gz
==> Pouring openjdk-13.0.2+8_2.catalina.bottle.tar.gz
==> Caveats
For the system Java wrappers to find this JDK, symlink it with
  sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk

openjdk is keg-only, which means it was not symlinked into /usr/local,
because it shadows the macOS `java` wrapper.

If you need to have openjdk first in your PATH run:
  echo 'export PATH="/usr/local/opt/openjdk/bin:$PATH"' >> ~/.zshrc

For compilers to find openjdk you may need to set:
  export CPPFLAGS="-I/usr/local/opt/openjdk/include"

==> Summary
🍺  /usr/local/Cellar/openjdk/13.0.2+8_2: 631 files, 314.6MB

When I start IntellJ, a pop-up from Mac says:

"openjdk-13.0.1.jdk” cannot be opened because the developer cannot be verified.
macOS cannot verify that this app is free from malware.
Homebrew Cask downloaded this file on 3 December 2019 from openjdk.java.net.

How to fix this? Is the file cached (from December) not being updated?

like image 962
jactor-rises Avatar asked Mar 30 '20 16:03

jactor-rises


People also ask

How do I run Java on Mac Catalina?

Open System Preferences -> Security & Privacy -> General , there should be a message about the JDK app, click Allow . Run the Java-based app again (e.g.: type java -version in the Terminal app). A dialog should appear confirming you trust OpenJDK. Show activity on this post.

Does Java work on Mac Catalina?

Changes introduced with macOS 10.15 (Catalina) cause certain Java applications to behave incorrectly. Therefore, we cannot certify any JDK version on macOS 10.15 yet. However, as of now, you can install and run non-notarized software on macOS 10.15 systems by modifying your security preferences.

Where is Java installed on Mac Catalina?

In macOS, the JDK installation path is /Library/Java/JavaVirtualMachines/jdk-10. jdk/Contents/Home . The root directory of the JDK software installation.


2 Answers

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:

Java security confirmation

like image 151
Hüseyin Yağlı Avatar answered Oct 13 '22 01:10

Hüseyin Yağlı


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`"
like image 32
freedev Avatar answered Oct 13 '22 02:10

freedev