Thinking in Java 4th Edition Source Code

Thinking in Java 4th Edition Source Code

Instructions for downloading, installing and testing the source code

  1. Download the source code zip file from this link.
  2. Create a directory in which to install the code. For these instructions, we‘ll refer to this directory as C:\TIJ4\code.
  3. 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, among other things, subdirectories corresponding to the chapters in the book.
  4. Install the Java JDK SE5 or later from the download site at Sun. You‘ll also eventually want the documentation, which is available further down on that page. You may also choose to install Java SE6; the code will work with that as well. Note that the most reliable approach is to install to the default directories.
  5. Add the bin directory of your JDK to your path.
  6. 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 to 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 name" box, and
    .;..;C:\TIJ4\code;
    In the "Variable value" box, then click "OK". To verify that your classpath has been set, start a command prompt (see below), then enter set and look for the CLASSPATH information in the output.
  7. Install the Ant build tool by following the instructions you will find in the Ant download. Note: Ant is not required in order to compile the examples in the book. It is used to automate the process, but you can also compile each example individually (once you have the CLASSPATH set, as described above) using the javac command-line compiler that was installed when you completed the previous step (note that you may have to set the Windows PATH to point to javac.exe). To compile a file called MyProgram.java, you type javac MyProgram.java.
  8. Start a command prompt in the C:\TIJ4\code directory. To do 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.
  9. At this point you should be able to start a command prompt in C:\TIJ4\code and type ant build, and the build should successfully compile all the chapters up to the io chapter, where it will fail with an error message about a missing library. If you only need to work with chapters before io for now, this will suffice for awhile.
  10. 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).
  11. To build the entire code base, you‘ll need to install the additional libraries. These include:
    • XOM
    • Javassist
    • The javaws.jar library, which comes with the standard Java installation, but which you must explicitly place in your classpath (described below).
    • 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 your platform. Further details about finding the jar file are 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 directory that is part of the "Java Runtime" that will be set up when you install the Java SE5 or Java SE6 development kit. You may have to hunt around for the JRE, but it can often be found under your "Program Files" directory, under "Java."

  12. Alternatively, you can explicitly install each of the Jar files. To do this, you must add each one 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;.
  13. This code is designed to work outside of IDEs. Because packages are 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 will have to make some adjustments (however, see the Eclipse.py program in the download package for some help). Different IDEs have different requirements and it may be more trouble than it‘s worth while you‘re getting started; instead, you may want to begin with a more basic editor like JEdit.

You may also want to add yourself to the low-volume newsletter to find out about future books, supplements, seminars and public speaking events by Bruce Eckel.

Return to Thinking in Java 4th Edition

时间: 2024-10-12 15:47:56

Thinking in Java 4th Edition Source Code的相关文章

《Thinking in Java 4th Edition》读书笔记之1.1 抽象过程

Q:什么是面向对象?与面向过程的区别是什么? A:面向对象:即面向问题空间,基于问题进行抽象: 面向过程:即面向解空间,基于计算机结构进行抽象: OOP的五个基本特性: 1)万物皆对象. [解释] 可以抽取待求解问题的任何概念化构件,将其表示为程序中的对象. 2)程序是对象的集合,他们通过发送消息来告知彼此所要做的. [解释] 即对某个特定对象的方法的请求. 3)每个对象都有自己的由其他对象构成的存储. [解释] 可以通过创建包含现有对象的包的方式来创建新类型的对象,因此可以在程序中构建复杂的体

Android source code compile error: “Try increasing heap size with java option '-Xmx<size>'”

export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g" ./prebuilts/sdk/tools/jack-admin kill-server ./prebuilts/sdk/tools/jack-admin start-server Android source code compile error: "Try increasing heap size wi

《Beginning Hibernate-For Hibernate 5, 4th Edition》(01_导读介绍)

<Beginning Hibernate-For Hibernate 5, 4th Edition> 这是一本介绍Hibernate5的图书,Hibernate 5是Hibernate框架的最新版本,这是目前市面上唯一一本介绍Hibernate5特性的图书,图书的链接https://www.amazon.cn/%E5%9B%BE%E4%B9%A6/dp/1484223187/ref=sr_1_1?ie=UTF8&qid=1491804196&sr=8-1&keyword

android activity 启动过程分析(source code 4.4)

说实话,android source code从2.3到4.4变化是蛮多的,尤其是media部分,虽然总的框架是没有多大变化,但是找起代码来看还是挺麻烦的.在android里面最受伤的是使用了java,jni,jvm,Nativity c++等等,各种设计模式横行,当然在学习源码过程中也意识了编程语言基础,数据结构,设计模式的重要性. android source code 经典的地方: 1. 大量使用了各种设计模式如单例模式,装饰模式,工程工厂模式,适配器模式等等. 2. 使用了binder驱

《Algorithms 4th Edition》读书笔记——2.4 优先队列(priority queue)-Ⅴ

命题Q.对于一个含有N个元素的基于堆叠优先队列,插入元素操作只需要不超过(lgN + 1)次比较,删除最大元素的操作需要不超过2lgN次比较. 证明.由命题P可知,两种操作都需要在根节点和堆底之间移动元素,而路径的长度不超过lgN.对于路径上的每个节点,删除最大元素需要两次比比较(除了堆底元素),一次用来找出较大的子节点,一次用来确定该子节点是否需要上浮. 对于需要大量混杂的插入和删除最大元素操作的典型应用来说,命题Q意味着一个重要的性能突破(详见优先队列增长数量级表).使用有序或是无序数组的优

MySQL 5.7.18 Source Code Installation

1  下载 1.1 下载网址: www.mysql.com 1.2 下载方法 1.2.1 进入主页后,选择 DOWNLOADS ,这时我们进入了下载页面.如下载的网址所示https://www.mysql.com/downloads/ 1.2.2 进入下载页面后,可以看到很多产品,这里我们将滚动条拉到最下面. 我们要下载的是MySQL Community Edition(GPL) 1.2.3 进入MySQL Community后. selecting operating system选择Sour

Java后台漂亮的code format

<?xml version="1.0" encoding="UTF-8" standalone="no"?><profiles version="11"><profile kind="CodeFormatterProfile" name="AnyKit Profile" version="11"><setting id=&qu

Setup Spark source code environment

1. Install Java and set JAVA_HOME 2. Install IntelliJ IDH and Scala plugin 3. Download spark1.0.0 4. Generate a workspace for IDEA [[email protected] spark-1.0.0]$ export http_proxy=proxy01.cd.intel.com:911[[email protected] spark-1.0.0]$ sbt/sbt -Dh

Learning English From Android Source Code:1

英语在软件行业的重要作用不言自明,尤其是做国际项目和写国际软件,好的英语表达是项目顺利进行的必要条件.纵观眼下的IT行业.可以流利的与国外客户英文口语交流的程序猿占比并非非常高.要想去国际接轨,语言这一关一定要过. 本人做刚入行的时候非常想找一本专门写给程序猿的英文教材,但并没有找到特别合适的.通过这几年的欧美项目经理,我发现与国外同行交流重在表明交流的意图而轻语法规定.一件事情的表述,仅仅要可以用几个Key Words来表述清楚.两方可以理解就可以.并没有使用我们上学期间艰深晦涩的语法知识.