Dean Schulze
Dean Schulze

Reputation: 10303

keytool error: java.io.FileNotFoundException: cacerts (Access is denied)

This question has been asked several times but none of the solutions work for me. I running the DOS command window as Administrator, but when running the keytool command to install a certificate I get the error above:

C:\Program Files\Java\jdk1.8.0_191\jre\lib\security>keytool -import -file xxx.yyy.zzz.crt -alias xxxx.yyy.zzz.com -keystore cacerts -storepass changeit -noprompt
Certificate was added to keystore
keytool error: java.io.FileNotFoundException: cacerts (Access is denied)

I'm on Windows 10 with JDK 1.8.0_191. Why would access be denied to the Administator?

Upvotes: 1

Views: 26129

Answers (3)

Bibin
Bibin

Reputation: 41

I have faced the same issue.

Here is the solution what I found:

  1. Copy the cacert file other than Java folder [May be D drive or desktop].
  2. Update the path of cacert file path in your command [Sated in question].
  3. Run your query. [You wont get the io exception].
  4. Then replace the new cacert file in the original location.

Upvotes: 4

RoutesMaps.com
RoutesMaps.com

Reputation: 1690

"Run as administrator Command prompt" has fixed this issue at Windows.

Upvotes: 6

Dean Schulze
Dean Schulze

Reputation: 10303

My problem was that I did not have true admin rights to my Windows 10 laptop. I had enough permissions to install the JDK to the default location (which requires admin rights), but not enough rights to use keytool.

I uninstalled the JDK from the default location and reinstalled it in a directory that was not restricted to admin users. Then keytool worked properly.

Upvotes: 2

Related Questions