hi
I must connect with a linux host via ssh.
I found the library "Ganymed", it seemed to work but I saw that some commands do not give me the desired result.
For example, I tried to run the following commands
"pwd"
"cd .."
"pwd"
the output of the first command is the same as the third.
This is the basic code for the ssh connection
Java Code:
String hostname = "127.0.0.1";
String username = "joe";
String password = "joespass";

try
{
/* Create a connection instance */
Connection conn = new Connection(hostname);

/* Now connect */
conn.connect();

boolean isAuthenticated = conn.authenticateWithPassword(username, password);

if (isAuthenticated == false)
   throw new IOException("Authentication failed.");

/* Create a session */
Session sess = conn.openSession();

sess.execCommand("uname -a && date && uptime && who");

System.out.println("Here is some information about the remote host:");

InputStream stdout = new StreamGobbler(sess.getStdout());
BufferedReader br = new BufferedReader(new InputStreamReader(stdout));
while (true)
{
   String line = br.readLine();
   if (line == null)
      break;
   System.out.println(line);
}

/* Show exit status, if available (otherwise "null") */
System.out.println("ExitCode: " + sess.getExitStatus());

/* Close this session */
sess.close();

/* Close the connection */
conn.close();

}
catch (IOException e)
{
   e.printStackTrace(System.err);
   System.exit(2);
}

In jar file of the library I found other examples, that creates a shell using swing.
In this example the comand go well.
Someone knows how to solve my problem?
You know other library that can I use?
Before "Ganymed" I tried "jsch" library and I have the same problem.
Thank you in advance for you answer