Java Reference
In-Depth Information
initially. This is a time saver when you're fixing bugs. Make sure you've enabled
the option to build the project with each run, and then pin the tab. Now you can
fix bugs and continually rerun the application as needed.
5.4 Expanding the ACME project
Now, the practical question: How does this material apply to the
ACME
project? If
you had a full development team with numerous interdependent projects on the
go, you might want to leverage existing modules written by other people in the
CurrencyConverter
. Unfortunately, the simplicity of the example precludes such
complexities. You can, however, integrate a third-party library relatively easily.
5.4.1
Adding a library to the ACME project
The Log4J project can be found at http://logging.apache.org. It's an open source
software framework for logging application debugging messages. It defines an
API
that permits sophisticated logging to be enabled at runtime with requiring
modification to the application binary. It was also designed to have a minimal
impact on performance, so that source code with Log4J
API
calls can be included
in production code without incurring a heavy performance cost. You'll use
IDEA
's
modular library mechanism to include Log4J into the project and then put some
logging code into the service.
The first step is to retrieve Log4J from its official web site. In your web browser
of choice, visit http://logging.apache.org and navigate to the
Download
section.
Download the software release (for example, at the time of this writing, the
archive containing the binaries and source files was called jakarta-log4j-
1.2.9.zip). Save and expand it to some directory on your local file system.
Follow these steps to add the library to
IDEA
and then include that library in
your
ACME
module:
1
Select the
File | Settings
option (
Ctrl+Alt+S
) to open the
Settings
window.
2
Click the
Paths
icon to open the
Paths
configuration window.
3
CurrencyConverter
should be the only available module in the
ACMECC
project, but if it isn't, ensure that the
CurrencyConverter
module is
selected in the
Modules
list on the left side of the window.
Click the
Libraries (Classpath)
tab to bring the libraries configuration
panel to the front.
4
In the
Used Global Libraries
area of the panel (bottom right), click the
Edit
button to configure the library definitions.
5