Search code examples
androidauthenticationkeytool

Unable to import certificate in keytool


I am using following command to import the certificate in KeyStore:

"%JAVA_HOME%"\bin\keytool -importcert -trustcacerts -alias c:\cacert-Service -file c:\e-Service.cer -keystore "%JAVA_HOME%"\jre\lib\security\cacerts

it asked for a password, and show the following result on CMD:

 Certificate was added to keystore
 keytool error: java.io.FileNotFoundException: C:\Program Files (x86)\Java\jdk1.6
 .0_20\jre\lib\security\cacerts (Access is denied)

What is going wrong?


Solution

  • This could happen if you are not running the command prompt in administrator mode. If you are using windows7, you can go to run, type cmd and hit Ctrl+Shift+enter. This will open the command prompt in administrator mode. If not, you can also go to start -> all programs -> accessories -> right click command prompt and say run as administrator.

     http://stackoverflow.com/questions/10321211/java-keytool-error-after-importing-certificate-keytool-error-java-io-filenot?rq=1