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

Mossi picture Mossi · Sep 4, 2015 · Viewed 53.2k times · Source

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?

Answer

Muhammad Omar ElShourbagy picture Muhammad Omar ElShourbagy · Dec 7, 2016

Try running the command line as administrator and do it again