4

I get the above message when trying to run my JDK. I installed it last week and it works fine during the day. I then Shutdown my laptop and when I re-start it the next day I get this message when I try running my Java application or when I try java -version from the Terminal window.

My macOs is, macOS 10.15.4 (19E287) - Catalina

I have other versions of the Java JDK installed on my laptop and haven't had any problems previously with those....so am a bit confused why I am getting this now.

One thing I should mention is that after I have untar'd the JDK download I then untar the JMC-7 package (Java Mission Control), jmc-7.0.1+01_osx-x64_bin/JDK Mission Control.app into the /Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home directory..... I am not sure if this maybe part of the issue ?

From exchanging some comments on a similar issue se-372017 I wonder if Apple OS notices the change to the JDK directory and thinks its maybe some malicious behaviour... how to tell macOs that its ok to ignore this check ?

Has anyone else seen this issue and has a fix for it ?

I could rm the JDK directory and re-untar the downloaded package again but I dont want to have to do this everyday !

robbie70
  • 173
  • 1
    https://apple.stackexchange.com/questions/58050/damaged-and-cant-be-open-app-error-message?rq=1 Remove the xattr from the file – anki Jun 15 '20 at 09:13
  • 1
    @ankii thank you - I tried following that using, sudo xattr -rc /Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home/bin/java but still get the same message ? should I issue the command to the top level directory, sudo xattr -rc /Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/ rather than the application maybe ? – robbie70 Jun 15 '20 at 09:41
  • At least for me, sudo xattr -rc /path/to/jdk-11.0.9.1+1 did fix the error, yes. – CletusW Dec 05 '20 at 05:49

2 Answers2

2

I think the problem might be that after I've installed the JDK I then go ahead and unzip (untar) the JFR (including JMC) package into a sub-directory of the JDK. I think that macOS detects that there has been a change and tries to protect you incase its a malicious virus attack.

I tried installing the JFR in a separate directory and then initially I got the same message when trying to run it. But then I found a post which suggested going into the macOS> System Preferences - Security & Privacy screen and there was a message asking if I wanted to give permission for this application (Java Mission Control) to run. I did and its worked fine since.

robbie70
  • 173
  • Yes that seems OK Treat all bundles and apps as something you cannot alter using finder or text editors. – mmmmmm Jun 24 '20 at 17:21
1

This will fix it sudo xattr -r -d com.apple.quarantine /Library/Java/JavaVirtualMachines/<jdk-version>

  • 3
    It’s helpful to explain what the command does to help less experienced users learn what the problem is and how this solved the issue – Allan Mar 28 '23 at 20:05