madhu
04-28-2010, 03:44 PM
This exception might arise when the shell prompt and the command line terminator is not set according to the server used. By default the shell prompt is set to "$" and the command line terminator is set to "/n". Suppose you are using a Windows server the shell prompt needs to be ">" and the command terminator can be "/r/n". To change these values call the setShellPrompt method and setCommandTerminator method before calling sshSession.connect().
For example,
SshParameters params = new SshParameters(ftpHostname,ftpUsername,ftpPassword) ;
SshSession sshSession = new SshSession(params);
sshSession.setShellPrompt(">"); //Windows
sshSession.setCommandTerminator("\r\n");
sshSession.connect();
String result = sshSession.send(command);
sshSession.disconnect();
For example,
SshParameters params = new SshParameters(ftpHostname,ftpUsername,ftpPassword) ;
SshSession sshSession = new SshSession(params);
sshSession.setShellPrompt(">"); //Windows
sshSession.setCommandTerminator("\r\n");
sshSession.connect();
String result = sshSession.send(command);
sshSession.disconnect();