hola estoy realizando una conexión ssh para windows con la libreria Ganymed
la cosa es que no se como ejecutar mas de un comando ala vez
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import ch.ethz.ssh2.Connection;
import ch.ethz.ssh2.Session;
import ch.ethz.ssh2.StreamGobbler;
public class asd
{
public static void main
(String[] args
) {
String hostname
= "192.168.56.2"; int port =2222;
try
{
conn.connect();
boolean isAuthenticated = conn.authenticateWithPassword(username, password);
if (isAuthenticated == false)
Session sess = conn.openSession();
Session sesss = conn.openSession();
sess.execCommand("cmd /c dir");
System.
out.
println("Here is some information about the remote host:");
InputStream stdout
= new StreamGobbler
(sess.
getStdout()); while (true)
{
if (line == null)
break;
}
System.
out.
println("ExitCode: " + sess.
getExitStatus()); sess.close();
conn.close();
}
{
e.
printStackTrace(System.
err);}
}
}