Reputation: 568
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?
Upvotes: 3
Views: 35860
Reputation: 9
Sometimes we forget to include the file type (.cer or .cert). For example, "xyz.cer" is a file. If the full file name with the file type is not included, the following command will fail:
keytool -importcert -file xyz -keystore keystore.jks -alias "Alias"
To ensure it works, use the full file name with the file type as shown below:
keytool -importcert -file xyz.cer -keystore keystore.jks -alias "Alias"
Upvotes: 0
Reputation: 2625
I was getting the similar error when I was trying to run the BAT file:
D:\Accela\av.biz\conf\certs>D:\Accela\bin\jdk1.7.0\jre\bin\keytool.exe -import - noprompt -alias stgdiitehsccatsii.health.dohmh.nycnet -keystore D:\Accela\av.biz \conf\certs\trusted_cacerts -file D:\Accela\av.biz\conf\certs\stgdiitehsccatsii. health.dohmh.nycnet.cer -storepass changeit keytool error: java.io.FileNotFoundException: D:\Accela\av.biz\conf\certs\stgdii tehsccatsii.health.dohmh.nycnet.cer (The system cannot find the file specified)
D:\Accela\av.biz\conf\certs>pause Press any key to continue . . .
I was able to fix it just changing the extension from .cer to .crt on the BAT file code:
D:\Accela\av.biz\conf\certs\stgdiitehsccatsii.health.dohmh.nycnet.cer
to
D:\Accela\av.biz\conf\certs\stgdiitehsccatsii.health.dohmh.nycnet.crt
Since that was the right extension for the certificate file.
Upvotes: 0
Reputation: 525
1.Advice: run Comand Prompt as administrator ( If you are using windows 7, you can go to run, type cmd and hit Ctrl+Shift+enter. This will open the command prompt in administrator mode.)
2.C:...... > keytool -importcert -file "C:part/to/file.crt" -keystore "%JAVA_HOME%\jre\lib\security\cacerts" -alias 1Alias (Do not forget that file with .crt )
3.password - changeit
Upvotes: 0
Reputation: 41
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 :
clojars.org
( this name you need to give in front of -alias)C:\Program Files\Java\jdk1.8.0_172\jre\lib\security
, so we can just give
/cacertsIf it asks for password, default is changeit, so keep the same everytime
Hope this solves your problem. :)
Upvotes: 4
Reputation: 19
just create file in any other directory than c: Drive for eg: create in d: Drive
Upvotes: 0