Tuesday, January 5, 2016

Reinstalling the JDK Is One Way to Fix: java.io.IOException: Invalid keystore format

Prior to installing the latest JDK, when I executed the following command in Terminal.app:

keytool -list -keystore $(/usr/libexec/java_home)/jre/lib/security/cacerts -v

It resulted in:

keytool error: java.io.IOException: Invalid keystore format
java.io.IOException: Invalid keystore format
at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:650)
at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:55)
at java.security.KeyStore.load(KeyStore.java:1445)
at sun.security.tools.keytool.Main.doCommands(Main.java:792)
at sun.security.tools.keytool.Main.run(Main.java:340)
at sun.security.tools.keytool.Main.main(Main.java:333)

To fix, I (re)installed the latest Oracle JDK and restarted Terminal. After that, when I execute the following command:

keytool -list -keystore $(/usr/libexec/java_home)/jre/lib/security/cacerts -v

I get:

Enter keystore password:  

indicating that the keytool on path can access the keystore.

Note: I also posted this in StackOverflow.

No comments: