I can able to upload local system file to SFTP client using below code,
try {
final SSHClient ssh = new SSHClient();
ssh.addHostKeyVerifier(new PromiscuousVerifier());
ssh.connect("100.XX.XX.XX");
ssh.authPassword("username", "password");
// ssh.authPublickey(null, arg);
final String src = "C:\\LocalFolder\\SFTPData\\file.txt";
File localFile = new File(src);
System.out.println(localFile.getName());
SFTPClient sftp = ssh.newSFTPClient();
sftp.put(localFile.getAbsolutePath(), "/home/user/test");
} catch (Exception e) {
}
But the problem is, I need to transfer file from windows network shared path which requires username, password(\100.xx.24.55\SFTPData\file.txt).
How do we achieve this?