About the Examples
This book has hundreds of code examples, spread throughout its pages.
While some complete code listings are shown in the text, other examples
are shown only in part. While some readers may enjoy typing in
these programs on their own, many of us just don't have the time.
Because of this, every single example, and almost all of the partial examples,
are ready for compilation in Java source files, ready for download.Additionally, the process of compilation (especially class path issues)
remains one of Java's most problematic features. To help you out, an Ant
buildfile is included with the samples, called build.xml. You'll need to
download and install Ant (available at
ant.apache.org
) to take advantage of this buildfile, and I strongly urge you to do just that. Ant
installation is easy, and you can always refer to Ant: The Definitive Guide
(O'Reilly) if you need assistance. Your directory structure should look
something like this:
<basedir>
|
+--src (contains build.xml)
|
+--classes
|
you don't have Ant set up properly. Otherwise, you should see something
like the following:
I'll leave it to you to explore the other targets within build.xml; there are
${basedir}\code\src>ant
Buildfile: build.xml
compile:
[echo] Compiling all Java files...
[javac] Compiling 41 source files to code\classes
[javac] Note: code\src\com\oreilly\tiger\ch06\DeprecatedTester.java
uses or overrides a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
BUILD SUCCESSFUL
Total time: 9 seconds
also notes in most chapters about targets that apply to that chapter, or to
a specific example. All this code is heavily tested, and mildly documented.
Just make sure you've got Tiger as the first Java compiler on
your classpath, or you'll get all sorts of nasty errors!You may download this sample code, as well as check out errata, view
related resources and online articles, and see the latest on this book, at
www.oreilly.com/catalog/javaadn/
. Check this site often, as lots of
new content may be available as time goes by and we update the
examples.
