What will be the java code for connecting to linux box ? Manually I connect through Putty so my question how shall I integrate in java and connect Linux box Or there is any other way for connecting it.
I tried this code it didn't work. Please
import java.io.InputStream;
import java.io.OutputStream;
public class Test {
public static void main( String[] args ) throws Exception {
String[] cm = {
"ssh= C:\\users\\...\\putty.exe",
"[email protected]" ,
"df -h"
};
Process p = Runtime.getRuntime().exec( cm );
InputStream in = p.getInputStream();
OutputStream out = p.getOutputStream();
out.write( "password".getBytes() );
}
}