10.14. Obtaining Commons Net
Problem
You need to use Commons Net to write a simple FTP, SMTP, or POP3 client.
Solution
Download the latest version of Commons Net, and place the Commons Net
JAR in your project’s
classpath. Following the steps outlined in Recipe 1.1, download Commons Net 1.2.2 instead of
Commons Lang.
Discussion
Jakarta Commons Net contains some simple clients for commonly used
network protocols, such as FTP, TFTP, Telnet, NNTP, POP3, and SMTP.
Protocols are supported by collections of classes in packages
dedicated to these protocols. For example, FTP is supported by a set
of classes in the org.apache.commons.net.ftp
package, including FTPClient and
FTPFile; and SMTP is supported by classes in the
org.apache.commons.net.smtp package, including
SMTPClient.
If you have a Maven project that needs to use Commons Net, add a
dependency on Commons Net 1.2.2 with the following section in
project.xml:
<dependencies>
<dependency>
<id>commons-net</id>
<version>1.2.2</version>
</dependency>
....other dependencies...
</dependencies>See Also
For more information about Commons Net, see the Commons Net project page at http://jakarta.apache.org/commons/net.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access