I don't know what the problem is, but JSch, whatever that is, is not part of the Android SDK, so it's not the right forum to ask.
On Jun 13, 5:31 am, ABSOLUT <[email protected]> wrote: > Hi, > 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; > } > > } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

