0

I am trying to import a jfrog certificate into my keystore but getting the titled error. I used the following command to do this task:

keytool -importcert -file C:\Users\Ramen\Desktop\jfrog.cer -keystore "%JAVA_HOME%\jre1.8.0_202\lib\security\cacerts.jks -alias "JFROG_NEW"

Then it prompts me to put in password, at the end it says certificate was added to keystore and throws this error "keytool error:

java.io.FileNotFoundException: C:\Program Files\Java\jre1.8.0_202\lib\security (Access Denied)"

Please note that I can not run this command as administrator.

I tried all the answers I could get from stackoverflow from these links.

Java Keytool error after importing certificate , "keytool error: java.io.FileNotFoundException & Access Denied"

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

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

Is there any workaround for this issue without logging in as an administrator?

TylerH
  • 20,799
  • 66
  • 75
  • 101
  • In general, the Windows operating system requires Administrator access to modify the files inside the C drive. The C drive contains the files and folders of the operating system and those need to be protected. According to the error message, it seems like the user doesn't have enough permissions to access the cacerts file of JDK. As a workaround, we can change the JDK installation location to any other drive (Ex: D) and point the application to use that custom path. Otherwise, we need to get admin access to import the cert or provide enough permissions to the user(by using admin privilege). – Tatarao Vana Apr 11 '23 at 04:09
  • Thank You for your response. This worked for me, just had to remove keystore and its path. keytool -importcert -file C:\Users\Ramen\Desktop\jfrog.cer -alias "JFROG_NEW" – Lalmohan yadav Apr 12 '23 at 16:10

0 Answers0