I need help with connection to SFTP server? Does anybody have working code?
I found something like this
package test.JSch;
import com.jcraft.jsch.*;
I was having the same problem with a shell connection. The solution was to increase the timeout, in my case 5000 msec was enough
JSch jsch = new JSch();
Session session = jsch.getSession(USERNAME, HOSTNAME, SSH_PORT);
session.setPassword(PASSWORD);
Hashtable config = new Hashtable();
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);
session.connect(5000);