questions questions - 1 year ago 354
Bash Question

Java keytool - illegal option deststorepass:file

Thanks for your time. I'm trying to create a java keystore from a PKCS12 file.

This has worked before, but I've done some work to remove password visibility from the command line, using the command

keytool -importkeystore -deststorepass:file ...

This functionality is apparently available in Java > 7:

-storepass[:env|:file] argument Note: All other options that require passwords, such as -keypass, -srckeypass, -destkeypass -srcstorepass, and -deststorepass, accept the env and file modifiers. (Remember to separate the password option and the modifier with a colon, (:).)

but for some reason I get the message:
Illegal option: -deststorepass:file

Does anyone please know what I am doing wrong here, or how to correctly use the keytool command with the :file modifier?


I had set the java version to 1.7, but neglected to also set the keytool to the appropriate version.

update-alternatives --set keytool [path]