Skip to content

Unable to import certificate to cacerts

My requirement is to import a certificate for maven repositories into the global keystore.

The certificate file is named maven-cacert.cer .

I am using following command from C:Program FilesJavajdk1.6.0_20bin from cmd

keytool -importcert -trustcacerts -alias c:maven-cacert.cer -file c:maven-cacert.cer.der -keystore $JAVA_HOMEjrelibsecuritycacerts

as maven-cacert.cer file is in C directory

after pressing enter it asked to put password and after giving password it is saying like

keytool error: $JAVA_HOMEjrelibsecuritycacerts (The system cannot find the path specified

I also tried

   keytool -importcert -trustcacerts -alias c:maven-cacert.cer -file c:maven- cacert.cer.der -keystore usrjava/jdk1.6.0_20/bin/javajrelibsecuritycacerts

but getting same output

Please help what is going wrong with my command while cacerts file is inside $JAVA_HOMEjrelibsecurity directory.


Try using "%JAVA_HOME%jrelibsecuritycacerts"