Question

I need to import a certificate for some maven repositories into the global keystore. The certificate file is named maven.crt so the command I am running is

keytool -import -keystore $JAVA_HOME/jre/lib/security/cacerts -trustcacerts -alias maven -file maven.crt

It asks me for password and then if I trust the certificate to which I answer yes This is the final output

Certificate was added to keystore
keytool error: java.io.FileNotFoundException: /usr/java/jdk1.7.0_40/bin/java/jre/lib/security/cacerts (Not a directory)

I ran this command as root so I don't know why I am receiving permissions error here.

Was it helpful?

Solution

Your path is wrong. cacerts file is in jdk_directory/jre/lib/security.

Try this instead:

keytool -import -keystore /usr/java/jdk1.7.0_40/jre/lib/security/cacerts -trustcacerts -alias maven -file maven.crt
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top