Hi,
I'm using jsch with android. I'm using jsch to execute a command and then
shows me the output of
the command, but I cant see the ouput of command with LogCat. Could
you help me please? Many thanks and sorry for my english!
public String texto (String comando){
Log.d("PRUEBA", "CONSULTA CRON DENTRO DEL OBJETO");
String username = "xxxxxxxx";
String password = "yyyyyyyyy";
JSch jsch = new JSch();
Session session;
try {
session = jsch.getSession(username, "xx.yy.zz.aa",
22);
session.setPassword(password);
// Avoid asking for key confirmation
Properties prop = new Properties();
prop.put("StrictHostKeyChecking", "no");
session.setConfig(prop);
session.connect();
// SSH Channel
ChannelExec channelssh = (ChannelExec)
session.openChannel("exec");
ByteArrayOutputStream baos = new
ByteArrayOutputStream();
channelssh.setOutputStream(baos);
// Execute command
channelssh.setCommand("ls");
channelssh.connect();
channelssh.disconnect();
Log.d("PRUEBA","BIEN");
Log.d("PRUEBA","RESULADO ------" +
baos.toString());
return baos.toString();
} catch (JSchException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.d("PRUEBA","ERROR");
return null;
}
}
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users