Keytool password prompt option

I'm trying to call keytool inside a java program with Runtime.exec(). I want to call keytool to add a certificate to keystore. I can do it manually but when I do, it requires a password prompt. I'm using the command

$ keytool -import -file myCert.crt -trustcacerts -alias ldap

-keystore cacertsFile

Is there a keytool option that I can use to enter the password so that it dosn't prompt me for it?

[425 byte] By [tilbr01a] at [2007-10-2 16:58:30]
# 1
Yes, see the JDK tools documentation.
ejpa at 2007-7-13 18:11:35 > top of Java-index,Security,Other Security APIs, Tools, and Issues...
# 2
Yea, the doc says to use -keypass which dosn't work, for me at least. It still prompts you regardless. Did you try this or just assuming it works?
tilbr01a at 2007-7-13 18:11:35 > top of Java-index,Security,Other Security APIs, Tools, and Issues...
# 3
I have been using this option for years.
ejpa at 2007-7-13 18:11:35 > top of Java-index,Security,Other Security APIs, Tools, and Issues...
# 4

That's weird. I'm using this exact command:

keytool -import -file certString.crt -trustcacerts -alias ldap -keypass changeit -keystore cacerts

Btw, it also prompts me at the end:

Trust this certificate? [no]:

Is this supposed to be shut off by the -trustcacerts command? If so, do you have any idea why either of these commands arn't working?

tilbr01a at 2007-7-13 18:11:35 > top of Java-index,Security,Other Security APIs, Tools, and Issues...
# 5
There is also a password for the store itself. You can provide it with -storepass (default for cacerts is changeit)Another option that could help is -noprompt. However I have never used that one...
Elninoa at 2007-7-13 18:11:35 > top of Java-index,Security,Other Security APIs, Tools, and Issues...