Use com.trilead.ssh2 instead, you can find source codes for android from
Connectbot project

On Mon, Jun 13, 2011 at 5:31 AM, ABSOLUT <davidt...@gmail.com> 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 android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to