java.io.FileNotFoundException: (Operation not permitted) error with ./keytool -import on mac osx (el capitan) - Java 6
This seems to be a mac specific issue when the exception states (Operation not permitted)
-
For anyone else having this problem you need to reboot your mac and press ⌘+R when booting up. Then go into Utilities > Terminal and type the following commands:
csrutil disable
reboot
You should be able to import cacerts to your Java keystore following that. Don't forget to reenable csrutil
after you've imported that cacert. Reboot, press ⌘+R when booting up, Utilities > Terminal, enter:
csrutil enable
reboot
I was hit by similar issue on MacOS Big Sur while starting an jnlp file:
CouldNotLoadArgumentException[ Could not load file/URL specified: /Users/jhartman/Documents/Favorities/NCC/NCC 123.jnlp]
....
Caused by: java.io.FileNotFoundException: /Users/jhartman/Documents/Favorities/NCC/NCC 123.jnlp (Operation not permitted)
Solution for this was:
- Give Java (
/usr/bin/java
) Full Disk access - Give Java (
/usr/bin/java
) Files and Folders access to Downloads, Documents and Folders
Steps
- Open
/usr/bin
in Finder, e.g. by invoking from Terminal:
jhartman@MBP ~ % open /usr/bin
Localise
java
(andkeytool
)Open System Preferences and Security & Privacy. Open Full Disk Access tab and authorise
Drag
java
andkeytool
from Finder window opened in step 1 and drop onto the App list in Full Disk Access
- Go to Security & Privacy -> Files and Folders, tick Downloads Folder and Document Folder for
java
andkeytool
It was solution for my problem but I hope it should also sort out keytool
issue.