Apple - Can't run OpenJDK macOS Catalina "Can't verify it's not a Virus"

Go to System Settings -> Security & Privacy -> General -> click 'Allow' (below 'App-Downloads allowed from')

After that open a terminal and run java again (e.g. java -version). A new Dialog should appear with the possibility to trust OpenJDK futurewise.


For those who miss rejected the JDK execution (the confirmation dialog will not let you choose to open again) and there is no "allow" button found in the Security dialog, you will need the command-line tool spctl:

# verify if you have rejected the app:
spctl --assess /path/to/jdk
# add app exception:
spctl --add /path/to/jdk

For those who just want to use the java executables in the command line, go to:

System Preference > Security & Privacy > Privacy > Developer Tools

Add Terminal, iTerm2 or whatever applications you'd like to use

enter image description here


The issue is that macOS labels all downloaded binaries with a “quarantine” attribute which tells the system that it should not be run automatically before being explicitly approved by the user.

You have to manually remove the quarantine attributes from the folder where it’s been downloaded. You can do this easily in the terminal with this command:

xattr -d com.apple.quarantine /Library/Java/JavaVirtualMachines/adoptopenjdk-13.0.1.jdk

Note: I don't own this solution/answer, here is the reference blog. I am putting it here so that someone can find the answer easily.