3
votes

keytool error: java.io.FileNotFoundException: api.sepa.express.crt (The system cannot find the file specified)

I tried various examples which I found in stackoverflow.

keytool -importcert -file certificate.cer -keystore keystore.jks -alias "Alias"

and

    keytool -import -alias susan
   -file Example.cer -keystore exampleraystore

Tried using cmd as admin. I have placed my certificate file in Desktop. When I'm trying to copy in:

C:\Program Files\Java\jdk1.8.0_60\jre\lib\security

It's not accepting the certificate file.

What would be the preferred way to complete this command?

3

3 Answers

3
votes

Try adding the ssl file using command promt. It worked for me

2
votes

Firstly download the certificate into any of your directory, for me I choose (D:\My) where I kept my certificate with the name xyz.cert.

Second, you should be the admin of CMD/Command and write the word "keytool", it should give you the output as :

Key and Certificate Management Tool

Commands:

 -certreq            Generates a certificate request
 -changealias        Changes an entry's alias
 -delete             Deletes an entry
...something like this should be the output 

Third, As all the certificate are kept "cacerts" which is in the directory -
C:\Program Files\Java\jdk1.8.0_172\jre\lib\security

Use the below command from the directory -
C:\Program Files\Java\jdk1.8.0_172\jre\lib\security

keytool -import -alias clojars.org -keystore /cacerts -file D:/My/xyz.cer

Where to find what :

  1. When you double click on the certificate (xyz.cert in my case) it will open a pop up, where you will find in General Tab, Issued to : clojars.org ( this name you need to give in front of -alias)
  2. In front of -keystore should be the path of cacerts but as we are already in the directory C:\Program Files\Java\jdk1.8.0_172\jre\lib\security, so we can just give /cacerts
  3. file --> location of the certificate

If it asks for password, default is changeit, so keep the same everytime

Hope this solves your problem. :)

1
votes

just create file in any other directory than c: Drive for eg: create in d: Drive