Thinking in Java 4th Edition source codeinstructions for downloading, installing and testing the source code
- Download The source code zip file from this link.
- Create a directory in which to install the code. For these instructions, we'll refer to the This directory as C:\TIJ4\code.
- Using Winzip or some other zip utility, extract the zip file into the C:\TIJ4\code directory. When you ' re done, you should see several levels of directories, and in the C:\TIJ4\code directory, you'll see, AM Ong other things, subdirectories corresponding to the chapters in the book.
- Install the Java JDK SE5 or later from the download site at Sun. You'll also eventually want the documentation, which is available further off on that page. Also choose to install Java SE6; The code would work with that as well. Note The most reliable approach are to the default directories.
- Add the bin directory of your JDK to your path.
- Set the CLASSPATH in your computer ' s environment. For Windows machines, right-click on the "My Computer" icon and select "Properties." Then select the ' Advanced ' tab and click the ' Environment Variables ' button at the bottom. Under "System Variables," Look for see if there ' s already a "CLASSPATH" variable. If there is, double click and add
;.;..; C:\TIJ4\code;
to the end of the current entry. If there is no "CLASSPATH" variable, click the "New" button and enter
CLASSPATH
in the "Variable NA Me "box, and
.;..; C:\TIJ4\code;
in the "Variable value" box and then click "OK". To verify that your classpath have been set, start a command prompt (see below), then enter Set the CLASSPATH information in the output.
- Install the Ant build Tool by following the instructions you'll find in The ant down Load. note: Ant is not required on order to compile The examples in the book. It's used to automate the process, but you can also compile each example individually (once you have the CLASSPATH set, a s described above) using the javac command-line compiler that is installed when you completed The previous step (note that your may has to set the Windows PATH to point to Javac.exe ). To compile a file called Myprogram.java , you type javac Myprogram.java .
- Start a command prompt in the C:\TIJ4\code directory. To does this in Windows, press the "Start" button, then select "Run" and type "cmd" and press "OK." Then type
CD C:\TIJ4\code
into the resulting command window.
- At the should is able to start a command prompt in C:\TIJ4\code and type ant build, and the B Uild should successfully compile all the chapters up to the IO chapter, where it'll fail with an error message About a missing library. If you have need to work with chapters before IO for now, this would suffice for awhile.
- You can also move into individual chapters and type ant (to compile and execute the code in that chapter) or Ant build (to compile, the code only).
- to build the entire code base and you'll need to install the additional libraries. These include:
- XOM
- Javassist
- the Javaws.jar libr ARY, which comes with the standard Java installation, but which you must explicitly place in your classpath (described Bel ow).
- the Eclipse SWT library. Click on the most recent build number, then scroll down to "SWT Binary and Source" and select the file corresponding to yo ur platform. Further details about finding the jar file is in the book under the heading "Installing SWT."
In general, you can install the above Jar files by placing them in the Jre/lib/ext dire Ctory that's part of the "Java Runtime", that'll be set to when you install the Java SE5 or Java SE6 Development Kit. Hunt around for the JRE, but it can often is found under your "program Files" directory, under "Java."
- Alternatively, you can explicitly install each of the Jar files. Must add each of the to your CLASSPATH, following the directions shown earlier on this page. however, You must also include the name of the Jar file in the CLASSPATH entry . For example, if you put the Xom.jar file in a directory called C:\TIJ4\ Libraries\ , then the associated CLASSPATH entry would be C:\TIJ4\libraries\xom.jar; .
- This code was designed to work outside of IDEs. Because packages is not introduced until later chapters, and some of the fancier IDEs like Eclipse require all code to be In packages, if you want to use the code inside those IDEs you'll have a to do some adjustments (however, see the E clipse.py Program in the download package for some help). Different IDEs has Different requirements and it may is more trouble than it's worth while you ' re getting started; Instead, want to begin with a more basic editor like JEdit.
Also want to add yourself to the Low-volume newsletter to find out about future books, supplements, seminars and P Ublic Speaking events by Bruce Eckel.
Return to thinking in Java 4th Edition
Thinking in Java 4th Edition Source Code