You want to use Commons Lang because your program needs to use some of the simple utilities this component provides, such as array manipulation, date manipulation, and enums.
To download the latest version of Commons Lang, follow these steps:
In a web browser, open the URL http://jakarta.apache.org/site/binindex.cgi. This URL will select a mirror, and generate a page with links to download binary distributions from an Apache mirror.
Find the Commons Lang project section. If you search for the term “Commons Lang,” you will find a section that provides a link to download the latest binary release of Commons Lang.
Click on either the 2.0 zip
or 2.0
tar.gz
(depending on your platform) to download Commons
Lang 2.0.
Unzip or untar the binary distribution. This will create a directory
named commons-lang-2.0
. The
commons-lang-2.0
directory should now contain a
Java Archive (JAR) file, commons-lang-2.0.jar
.
Copy or add commons-lang-2.0.jar
to your
classpath.
Step #5 varies based on your development environment. If you are
working with Apache Ant as a build tool, you will need to make sure
that your classpath includes the Commons Lang JAR. If you are using
an Integrated Development Environment (IDE) like Eclipse, you will
need to copy this JAR to a directory in your project, and alter your
project’s preferences to add Commons Lang 2.0 to the
“Java Build Path.” If you are using
Maven as a build tool, add the following dependency to the
dependencies section of your project.xml
:
<dependencies> <dependency> <id>commons-lang</id> <version>2.0</version> </dependency> ...other dependencies... </dependencies>
The Commons Lang library includes utilities for working with dates, exceptions, arrays, enums, and more. It is one of the most widely used libraries in open source Java. To learn more about Commons Lang, visit the Jakarta Commons Lang web site at http://jakarta.apache.org/commons/lang/.
At the time of writing, the most recent version of the Commons Lang
component was Version 2.0. If there is a more recent version of
Commons Lang available, use the latest version. Although not a
guarantee or a promise, most Jakarta Commons components strive for
backward compatibility. If an interface has been altered or
functionality removed, it will be noted in the release notes for a
newer version. If you are going to use a different version of the
Commons Lang component with the recipes in this chapter, make sure to
read the release notes, which are stored in the file
RELEASE-NOTES.txt
.
If you are having an issue with one of the utilities in Commons Lang, see Recipe 1.2 on joining the Commons-user mailing list. If you are looking for the source code, see Recipe 1.3 on obtaining the source code for Commons Lang. You can also visit the Commons Lang web site at http://jakarta.apache.org/commons/lang.
18.119.158.134