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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.212.160