Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am on Windows 10 with JRE8 and the command I'm using is:

C:\Program Files\Java\jre1.8.0_60\bin>keytool -keystore "C:\cacerts" -storepass changeit -importcert -file "C:\Users\MyUser\Desktop\sf.cer" -alias Symantec_Secure_Server_Class_3

Here's what I've tried so far:

  1. Gave the cacerts file full access to my user (eventhough I am an admin)
  2. Ran keytool as System Administrator in cmd
  3. Put cacerts in different locations (even tried C:\cacerts)

I keep getting the same error:

Certificate was added to keystore keytool error: java.io.FileNotFoundException: C:\cacerts (Access is denied)

What else can I do to import this certificate into my cacerts file?

like image 846
Mossi Avatar asked Sep 03 '15 22:09

Mossi


3 Answers

Try running the command line as administrator and do it again

like image 71
Muhammad Omar ElShourbagy Avatar answered Sep 24 '22 21:09

Muhammad Omar ElShourbagy


Use the below command:

keytool -genkey -v -keystore test.keystore -alias testkeystore -keyalg RSA -keysize 2048 -validity 10000

the issue was that I was not giving the filename i.e. {test.keystore} which needs to be created as keystore file.

This will resolve the issue.

like image 41
amit pandya Avatar answered Sep 24 '22 21:09

amit pandya


Try putting on another drive: D:\tmp or C:\tmp (other than root).

like image 39
ACV Avatar answered Sep 25 '22 21:09

ACV