简体   繁体   中英

Command line is prompting for password, cannot send password using java eclipse

I have a program that i am running and it brings up the command prompt screen, i give it my arguments, but then it asks for a password. I send it a password but i get an error, thinking the password is part of the previous arguments, here is some of my code:

Process p = Runtime.getRuntime().exec("cmd /c start cmd.exe /k \"" + CD + AND + Keytool + Genkey + Keyalg + Keysize + Alias + Validity + Keystore +  "/K && " + Password);

The error is "Illegal Option password"

Any Ideas?

I think i need to use a outputstreamwriter but I am not quite sure how.

Thanks

Don't you have to terminate the open quote?

Process p = Runtime.getRuntime().exec("cmd /c start cmd.exe /k \"" + CD + AND + Keytool + Genkey + Keyalg + Keysize + Alias + Validity + Keystore +  "/K \" && " + Password);

Or even after the password, maybe

Process p = Runtime.getRuntime().exec("cmd /c start cmd.exe /k \"" + CD + AND + Keytool + Genkey + Keyalg + Keysize + Alias + Validity + Keystore +  "/K && " + Password + "\"");

You should do the following:

  1. Remove the password from the code
  2. Enter the password when it tells you to

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM