In this video I'll cover how the following SFTP operations can be performed by a Java program using the JSch library:
- Connecting to SFTP servers
- Authenticating to SFTP servers
- Listing directories
- Changing directories
- Downloading files
- Uploading files
I also cover how to handle the following errors:
- com.jcraft.jsch.JSchException: invalid privatekey
- com.jcraft.jsch.JSchException: UnknownHostKey
- com.jcraft.jsch.JSchException: Auth fail
While not necessary, if you enjoyed this video, buying me a coffee is greatly appreciated!
www.buymeacoffee.com/prodprog... (no refunds)
Introduction: (00:00)
Connection to the SFTP Server: (00:37)
Dealing with UnknownHostKey error: (01:26)
Authentication: (05:38)
Creating the SFTP Channel: (10:41)
Listing and Changing Directories: (12:25)
Downloading Files: (15:30)
Uploading Files: (16:58)
Conclusion: (19:45)
Source Code from Video Main.java:
gist.github.com/productivity-...
21 июл 2024