Kooshiar Azimian
Kooshiar Azimian

Reputation: 75

How to FTP in Java

I'm trying to download files through FTPS, the result file is always empty. (I'm using org.apache.commons.net.ftp.FTPClient)

FTPSClient client = new FTPSClient( );
OutputStream outStream;

client.connect("ip");
client.login("user", "pass");

String remoteFile = "filePath";
outStream = new FileOutputStream( "destinationFile" );
client.retrieveFile(remoteFile, outStream);
outStream.flush();

Upvotes: 1

Views: 293

Answers (1)

Shamis Shukoor
Shamis Shukoor

Reputation: 2515

JSch Java library is a good option for your problem

Upvotes: 1

Related Questions