93

Since I received no positives answers to my last question. I will try to write a Java FTP upload applet myself.

My question is: "Can you recommend a Java FTP client library for me to use?"

I want it to be:

  • stable
  • able to handle passive and active modes
  • able to provide upload progress information
  • throw catchable exceptions if something went wrong (especially when an upload does not succeed)
  • cheap/free to use, preferably open source

I found this overview of some libraries, but since this article is from 2003, maybe some new developments have happened :)

Community
  • 1
  • 1
Tader
  • 25,802
  • 5
  • 26
  • 27

9 Answers9

57

Check out Apache commons-net, which contains FTP utilities. Off the top of my head I'm not sure if it meets all of your requirements, but it's certainly free!

Leigh
  • 4,268
  • 1
  • 27
  • 17
  • This info bit is added here although it is unrelated to the question - just wanted to place it somewhere. commons-net FtpClient still lacks IPv6 support (RFC 2438) in the latest 2.0 release dated 2008. 2.1 is supposed to include it however. They dont release very often... – Moritz Both Oct 03 '10 at 22:30
  • 2
    @Moritz Both: That was finally fixed in 2010. See https://issues.apache.org/jira/browse/NET-288 . – sleske Aug 16 '11 at 14:06
  • I am trying to use the suggested FTP library but it's giving problems behind a network proxy, any suggestions? – Ashish Sharma Feb 06 '12 at 11:25
  • 2
    The speed is rather slow with this library, looking for a faster library. – Tommy Ng Aug 01 '12 at 12:28
  • @TommyNg I fixed the slowdown by removing a quota from the FTP server and by increasing the buffer size. Maybe it can help you. – gouessej Jan 19 '16 at 10:52
17

ftp4j is the best one, both for features and license:

http://www.sauronsoftware.it/projects/ftp4j/

Cocco
  • 171
  • 1
  • 2
  • 5
    The downside is that it's not in Maven Central – yegor256 Jul 18 '13 at 12:58
  • 9
    I don't understand why not upload library to Maven Central... Is this religious or political decision? – gavenkoa Jun 25 '14 at 11:26
  • 2
    @gavenkoa as I understand, to upload your project to maven central you are almost forced to use maven as your build tool. If one is building with ant (as ftp4j is), is not that easy, and I guess the author doesn't care enough to make this happen. – Paŭlo Ebermann Jun 08 '15 at 17:37
  • 1
    Gathering dependencies with Maven repositories are usual for Java (as pip for Python, Gems for Ruby). Even in Ant there are Ivy. Developers may have no time or money to do upload work, who knows? – gavenkoa Jun 09 '15 at 20:08
  • @PaŭloEbermann No it's possible to use Ant as a build tool and to upload the library on Maven Central, this is what we do for JogAmp (JOGL, JOAL, JOCL). Moreover, you can have your own Maven repository instead of abusing of centralization in order to respect some political considerations that I fully understand. – gouessej Jan 19 '16 at 10:50
  • Someone uploaded it to github and make it usable from maven :) https://github.com/asbachb/ftp4j – nacho4d Aug 20 '18 at 09:04
  • Please note that ftp4j looks unmaintained. The last version 1.7.3 on GitHub is from 2015 and there hasn't been any activity since. I wouldn't recommend using outdated libraries. – spiegelm Jan 05 '23 at 10:32
6

I used Apache Commons VFS

cya

sourcerebels
  • 5,140
  • 1
  • 32
  • 52
6

Yes, EnterpriseDT's edtFTPj is stable (first released in 2000), has all the features you might need, and is open source as well.

It's used in a bunch of open source projects (as well as in many commercial projects), and is acknowledged to be one of the fastest client libraries around.

As another poster noted, if you do wish to upgrade to SFTP and/or FTPS, it is a simple upgrade path with very few code changes required.

Bruce Blackshaw
  • 986
  • 1
  • 7
  • 10
4

Commons-net surely. :) Most open source projects use it these days.

yc

yclian
  • 1,490
  • 14
  • 22
1

I have successfully used the Enterprise DT FTP library, which is free and open source. I can't compare it to other libraries (like the Apache Commons Net library) since I haven't used them. It does provide a simple upgrade path to SFTP (over SSH) and FTPS (over SSL), though that is a pay-for commercial product.

Cozzman
  • 86
  • 3
1

Apache commons-nets get updates more frequently recently, while Enterprise DT library seems to update even more frequently.

Gatorhall
  • 411
  • 4
  • 7
0

I was downloading video files. Apache's FTPClient fumbled, it downloaded the video reasonably fast. but when I tried to play the video back, it lost chunks out of the middle of the video. ftp4j would download the whole video with no loss.

ftp4j ftw

0

You have also this 2006 article which lists different options for FTP clients.

commons-net is good, but FTP-GO can give you some of the more advanced features you are looking for.

kagi Ftp-Go

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250