Is there a way I can implement a secure FTP with org.apache.commons.net.ftp.FTPClient
?
If not, what are other options for Java?
Here's the official Apache download site for Commons Net. Once you've picked and extracted the appropriate version, set a dependency in your Eclipse project: Right-click the project and choose "Properties" Choose "Java Build Path" from the resulting popup.
Apache FTPClient doesn't support SFTP at the moment.
FTPClient encapsulates all the functionality necessary to store and retrieve files from an FTP server. This class takes care of all low level details of interacting with an FTP server and provides a convenient higher level interface.
SolarWinds Solar-PuTTY is our top pick for an FTP and SFTP client for Windows and Linux because it is the product of a leading system monitoring and management tool provider but it is completely free to use.
The methods of this class as other classes of Apache Commons Net FTP are wrappers for FTP manipulation, so the code which implemented those methods becomes significantly smaller, cleaner and understandable comparing to other programs where those functionalities are written manually. 1. A Closer Look to the org.apache.commons.net.ftp Package
Class FTPClient. public class FTPClient extends FTP implements Configurable FTPClient encapsulates all the functionality necessary to store and retrieve files from an FTP server. This class takes care of all low level details of interacting with an FTP server and provides a convenient higher level interface.
The FTPClient class will detect a premature FTP server connection closing when it receives a FTPReply.SERVICE_NOT_AVAILABLE response to a command. When that occurs, the FTP class method encountering that reply will throw an FTPConnectionClosedException .
The convention for all the FTP command methods in FTPClient is such that they either return a boolean value or some other value. The boolean methods return true on a successful completion reply from the FTP server and false on a reply resulting in an error condition or failure.
First, make sure you understand a difference between FTPS (Secure FTP) and SFTP:
FTPS versus SFTP versus SCP
If you need FTPS (aka Secure FTP or FTP over TLS/SSL), you can use FTPSClient
class from Apache Commons library instead of FTPClient
.
If you need SFTP (over SSH), you need a different library. See:
How to retrieve a file from a server via SFTP? or
Java SFTP Transfer Library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With