Unable to import certificate to cacerts
keytool -importcert -trustcacerts -alias mycert -file c:\maven-cacert.cer.der -keystore "%JAVA_HOME%"\jre\lib\security\cacerts
You also had a problem with alias. It's a name, not a file. You need to quote the "%JAVA_HOME%", because it has a space inside.
If you are using OpenJDK then the path for cacerts
will not be available in
"%JAVA_HOME%"/jre/lib/security/cacerts
it will be available in path
"%JAVA_HOME%"/lib/security/cacerts
Try using "%JAVA_HOME%\jre\lib\security\cacerts"
Use Bellow command to import the certificate in cacerts
- Run command prompt as Administrator
- cd C:\Program Files\Java\jdk1.6.0_45\jre\bin
- keytool -import -trustcacerts -file "certpath\certname.cer" -alias "cert_alias" -keystore "%JAVA_HOME%"/jre/lib/security/cacerts
- To view certificate keytool -list -keystore "%JAVA_HOME%"/jre/lib/security/cacerts -alias cert_alias