I am fairly new to java and now I want to use java to run SSH over windows command.
Here is the code i created,
Process pr1 = Runtime.getRuntime().exec("cmd /k" + "ssh root@host" + "&&" + "passwd" );
Process pr = Runtime.getRuntime().exec("ls");
BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line=null;
while((line=input.readLine()) != null)
System.out.println(line);
I was always given the error :
java.io.IOException: Cannot run program "ls": CreateProcess error=2, The system cannot find the file specified
Can anybody help me on this?