Compiling and running
To compile and run this program, and all the other programs in this book, you must first have a Java programming environment. There are a number of third-party development environments, but in this book we will assume that you are using the Java Developers Kit (JDK) from Sun, which is free. If you are using another development system, you will need to look in the documentation for that system to determine how to compile and run programs.
Get on the Internet and go to java.sun.com. There you will find information and links that will lead you through the process of downloading and installing the JDK for your particular platform.
Once the JDK is installed, and youve set up your computers path information so that it will find javac and java, download and unpack the source code for this book (you can find it at www.BruceEckel.com). This will create a subdirectory for each chapter in this book. Move to subdirectory c02 and type:
This command should produce no response. If you get any kind of an error message, it means you havent installed the JDK properly and you need to investigate those problems.
On the other hand, if you just get your command prompt back, you can type:
and youll get the message and the date as output.
This is the process you can use to compile and run each of the programs in this book. However, you will see that the source code for this book also has a file called build.xml in each chapter, and this contains ant commands for automatically building the files for that chapter. Buildfiles and Ant (including where to download it) are described more fully in Chapter 15, but once you have Ant installed (from http://jakarta.apache.org/ant) you can just type ant at the command prompt to compile and run the programs in each chapter. If you havent installed Ant yet, you can just type the javac and java commands by hand.