> hi,
> I would like to execute a command and read the output generated
[quoted text clipped - 11 lines]
> thx
> bye
A quick search on the internet showed 3 or 4 libraries with a class named SshClient in it.
What library are you using for the SshClient class? Try reading the API docs for that library first.
alcool - 09 Jan 2008 10:35 GMT
Solution found!
post the code;
SessionChannelClient session = ssh.openSessionChannel();
InputStream in = session.getInputStream();
session.executeCommand(command);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
StringBuffer buffer = new StringBuffer();
while ((line = br.readLine()) != null) {
buffer.append(line);
}
output = buffer.toString();