Ssh Output Always Empty
I've been trying to figure out this problem for hours now and I cant seem to figure it out. I'm trying to use JSch to SSH to a Linux computer from an Android phone. The commands al
Solution 1:
Found the answer I was reading the wrong stream. Heres the proper code for others with this problem.
InputStreaminputStream= channelssh.getInputStream();
BufferedReaderbufferedReader=newBufferedReader(newInputStreamReader(inputStream));
StringBuilderstringBuilder=newStringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null)
{
stringBuilder.append(line);
stringBuilder.append('\n');
}
return stringBuilder.toString();
Solution 2:
The exec-channel will be run on the other thread, so you need to wait for its termination before invoking Channel#disconnect().
Post a Comment for "Ssh Output Always Empty"