2

I'm new to Java, I was looking for a solution to execute specific commands Using ProcessBuilder. I have tried multiple approaches but in all, commands are executing in one go. For eg.

ProcessBuilder pb= new ProcessBuilder("plink","-ssh","username@XX.XX.XX.XX");
Process p=pb.start();

After this i am able to read output of command too (Which is asking for password), which i am unable to provide by any approach.

Basically i want to execute commands based on output of previous command in same Process/ProcessBuilder.

Thanks in advance.

Satyam pal
  • 21
  • 2
  • Please check if [this answer](https://stackoverflow.com/questions/18866381/how-can-i-run-multiple-commands-in-just-one-cmd-windows-in-java) replies to your question. – Nowhere Man May 05 '20 at 13:40
  • Do not use `plink` to implement SSH in Java. Use a native SSH Java library, like JSch. And then it will be easy to implement the *"time gap"*. – Martin Prikryl May 05 '20 at 13:44

0 Answers0