> i have written a java program to connect to a Server box using SSH2 but
> when i am executing the code its showing some eception. first I am
[quoted text clipped - 10 lines]
> Thanks
> Chandoo
In your program you are using the exec method that takes a String array
as arguments. In this array the first element is the program to be
executed, the remaining elements are the arguments for this program.
Your array has only one element: it tries to start the program "ssh2 -l
username serverbox.exe", which obviously didn't exist.
Split the command and its arguments yourself [2], or let the
Runtime.exec(String) do it four you [1].
So, use [1]:
String command = "ssh2 -l username serverbox";
Process p = Runtime.getRuntime().exec(command);
<http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html#exec(java.lang.String)>
Or [2]:
String[] cmdarray = {"ssh2", "-l", "username", "serverbox"};
Process p = Runtime.getRuntime().exec(cmdarray);
<http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html#exec(java.lang.String[])>

Signature
Regards,
Roland