14

Currently I am getting issue with new macOS Catalina limitation. Every time I run an app that require openJDK I get this message:

"openjdk-12.0.1.jdk" can’t be opened because it is from an unidentified developer.

Your security preferences allow installation of only apps from the App Store and identified developers.

But if I use the recommended way to bypass this issue (by going to System Preferences → Security & Privacy → General → Open Anyway button) it just opens the JDK folder. Which is not what I want.

How I can use JDK with macOS Catalina?

  • Could it be an issue with notarization? Did you try to notarize your app? – AbstractVoid Sep 26 '19 at 12:08
12

A solution, not sure if that's the only solution & the better one, is to run

sudo spctl --master-disable

Then run your app (validation will be kept by macOS Gatekeeper)

and right after that re-enable Gatekeeper with

sudo spctl --master-enable

This last step is important to keep you Mac safe :)

| improve this answer | |
  • 2
    Well, disabling system protection is never going to be a good option, but I can't see another way around for now. Hopefully OpenJDK will be updated soon enough to resolve this issue. – Rafael Soares Jul 5 '19 at 2:12
  • For me this is the only thing that worked. The allow message never enabled the java command to work, nor did spctl -add – Alexandre Roger Oct 8 at 3:32
12

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.

Source: https://apple.stackexchange.com/a/372235/35845

| improve this answer | |
  • 2
    This should be the accepted answer – YardenST Jul 8 at 14:56
5

After testing different options, pinning to the latest LTS cask worked for me. (edit: you will need to add the tap to show previous cask versions)

brew tap homebrew/cask-versions
brew cask install java11

Here's the output I get afterwards on Catalina Public Beta 2

java -version
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
| improve this answer | |
  • ℹ️This doesn't work for brew cask install java6 – Mikeumus Sep 16 '19 at 1:46
  • 1
    @Mikeumus the post clearly states "pinning to the latest LTS cask worked"; java6 is not the latest LTS, java11 is. please consider removing a downvote as a help to others. disabling gatekeeper is not a great option. – Chad Stovern Sep 17 '19 at 4:23
  • I'm sorry, I didn't downvote Chad 😄imgur.com/a/8maWkjP I left this note here for people looking to get java6 working and winding up here. I have my own Q/A for java6 here: apple.stackexchange.com/questions/370141/… – Mikeumus Sep 17 '19 at 19:01
  • 1
    gotcha thanks for clarifying; def not fishing for upvotes; merely hoping to avoid having people disable security on their Macs, that the other popular answer is advocating for. – Chad Stovern Sep 20 '19 at 14:08
  • 1
    Java 6 is 32-bit. 32-bit apps do not work on Catalina. Your best bet is to update to a Java a bit more modern than that (8 at the minimum, 11 or 12 preferred) – Matthew Barclay Oct 11 '19 at 14:20
1

I tried master-disable but the problem reoccured after a reboot. In my particular situation, brew isn't what I want either.

Only solution I've found that works for me is

xattr -d com.apple.quarantine /Library/Java/JavaVirtualMachines/openjdk1.8.0<version>/
| improve this answer | |
0

Detail steps to solve such problem on macOSX Catalina (or macOS-XI/11/X1 Big-Sur) is shown here https://apple.stackexchange.com/a/396025/133434

Summary:
• Download Java (JDK/SDK) version *.tar.gz file that you need for macOS from OpenJDK site into default "~/Downloads" folder, & verify its authenticity by comparing the OpenJDK site's shown SHA256 digest code, with the locally computed SHA256 digest code.
• Double-click on *.tar.gz to decompress it, & with a privileged user access+Password allow macOS to decompress it, (you will need allow decompress from here: "System Preferences" > "Security & Privacy" > under "General" tab > Goto bottomside section "Allow Apps Downloaded From" > press the "Allow" or "Open anyway" button).
• Move the decompressed new jdk*.jdk folder into "/Library/Java/JavaVirtualMachines/" folder
& with a privileged user access+Password allow macOS to complete the move.
• In Terminal, run: $($(/usr/libexec/java_home --version 12.0)/bin/java -version)
& again specify a privileged user access+Password, to allow macOS "Open"/run it.
• From that point-on, that java should work fine.
• before running a java based App, either setup the JAVA_HOME env var globally (see this) , or Use a shell-script: to select a specific Java version/folder before starting a specific java-based App.

if you're using Java 14, then change version number in above command, into --version 14.0
you can see all installed Java versions with: /usr/libexec/java_home -V

and avoiding brew/Homebrew(pkg-mngr) based solution would be better choice1, 2, 3, 4, 5, 6, ..., users may use Macports(pkg-mngr), etc.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .