![]() |
Getting Started 1An Embarrassment of Riches: The Linux Environment ............ 3 What You Will Learn ........................................................................... 3 The Command Line: What’s the Big Deal? ........................................ 4 Basic Linux Concepts and Commands ............................................... 5
1.3.9 The find Command 20 1.3.10 The Shell Revisited 21 1.3.11 The tar and zip Commands 26 1.3.12 The man Command 29 1.4 1.5 1.6 Chapter 2 2.1 2.2 Review 30 What You Still Don’t Know 30 Resources 30 An Embarrassment of Riches: Editors 33 What You Will Learn 33 Eye to Eye with vi 34 2.2.1 Exiting 40 2.2.2 Search and Replace 41 2.2.3 The Joy of Regular Expressions 43 2.2.4 Starting Off Right: .exrc 44 2.3 Editors Galore 45 2.3.1 Editing Your Pipes (sed, the Stream EDitor) 47 2.3.2 Simple Graphical Editors 47 2.4 2.5 2.6 Chapter 3 3.1 3.2 Review 49 What You Still Don’t Know 49 Resources 49 An Experienced Programmer’s Introduction to Java 51 What You Will Learn 51 Fundamental Language Elements 52 3.2.1 Scalar Types 53 3.2.2 Object Types 57 3.2.3 Statements 65 3.2.4 Error Handling, Java Style 74 3.2.5 print(), println(), printf() 78 3.3 Using (and Making) Java APIs 82 3.3.1 The package Statement 82 3.3.2 The import Statement 84 3.4 Encapsulation, Inheritance, and Polymorphism 85 3.4.1 Encapsulation 85 3.4.2 Inheritance 86 3.4.3 Polymorphism 91 3.5 3.6 3.7 3.8 3.9 3.10 3.11 Chapter 4 4.1 4.2 O, Templates! Where Art Thou? ......................................................... Virtually Final ...................................................................................... A Useful Simple Application ............................................................... Review ................................................................................................ What You Still Don’t Know .................................................................. Resources .......................................................................................... Exercises ............................................................................................ Where Am I? Execution Context .................................................. What You Will Learn ........................................................................... A Simple Start ..................................................................................... 93 94 95 95 97 97 98 99 100 100 4.2.1 4.2.2 Command-Line Arguments .................................................... Unit Testing Made Easy ......................................................... 100 102 4.3 The System Class ........................................................................... 102 4.3.1 4.3.2 4.3.3 Java and Standard I/O ........................................................... Environment Variables ........................................................... Java and Environment Variables ........................................... 102 104 105 4.4 4.5 The Properties Class ................................................................. The Runtime Class ......................................................................... 109 111 4.5.1 4.5.2 exec() ................................................................................ Portability ............................................................................... 111 113 4.6 4.7 4.8 Chapter 5 5.1 5.2 5.3 Review ................................................................................................ What You Still Don’t Know .................................................................. Resources .......................................................................................... The Sun Microsystems Java Software Development Kit ........... What You Will Learn ........................................................................... All You Need, and Not One Thing More ............................................. The Java Compiler ............................................................................. 113 113 114 115 116 116 117 5.3.1 5.3.2 Compiler Behavior, Defaults, and Environment Variables ..... javac Options ......................................................................... 117 119 5.4 The Java Runtime Engine .................................................................. 121 5.4.1 5.4.2 The Basics ............................................................................. java Options ........................................................................... 121 122 5.5 Complete, Up-to-Date Program Documentation Made Easy .............. 122 5.5.1 5.5.2 5.5.3 Running javadoc ................................................................... Javadoc Command-Line Options ........................................... Javadoc Comments ............................................................... 123 124 128 5.6 5.7 5.8 Dispensing with Applets ..................................................................... Going Native ....................................................................................... Introducing RMI .................................................................................. 131 132 137 5.8.1 5.8.2 5.8.3 5.8.4 5.8.5 A Brief Introduction to RMI ..................................................... The rmic Tool ........................................................................ The rmiregistry Tool ............................................................. Setting Up Servers and Clients .............................................. RMI Summary ........................................................................ 137 143 144 144 147 5.9 5.10 5.11 The Java Debugger ............................................................................ Return to the Source: The Java Decompiler ...................................... Bundling a Java Program: Put It in a JAR .......................................... 148 157 157 5.11.1 5.11.2 Deploying Applications ........................................................... Basic jar Operation ................................................................ 160 163 5.12 5.13 5.14 5.15 Chapter 6 6.1 6.2 The Rest of the Toolkit ....................................................................... Review ................................................................................................ What You Still Don’t Know .................................................................. Resources .......................................................................................... The IBM Developer Kit for Linux, Java 2 Technology Edition ... What You Will Learn ........................................................................... Use Linux Features to Make Multiple Java SDKs Play Nicely Together ............................................................................................. 164 166 166 166 167 167 168 6.2.1 6.2.2 Links ....................................................................................... Switching Java Versions by Symlink ...................................... 168 173 6.3 How the IBM JDK Differs from the Sun JDK ...................................... 174 6.3.1 6.3.2 6.3.3 Performance .......................................................................... Differences in the Commands ................................................ IBM Classes ........................................................................... 175 175 175 6.4 6.5 6.6 6.7 What Are All These “_g” Versions? .................................................... Review ................................................................................................ What You Still Don’t Know .................................................................. Resources .......................................................................................... 176 176 177 177 Chapter 7 7.1 7.2 7.3 7.4 The GNU Compiler for Java (gcj) ................................................. What You Will Learn ........................................................................... A Brand GNU Way ............................................................................. The GNU Compiler Collection ............................................................ Compiling Our Simple Application with gcj ........................................ 179 179 179 180 181 7.4.1 7.4.2 Compiling FetchURL with gcj ................................................ Compiling a Multiclass Program ............................................ 182 184 7.5 7.6 7.7 7.8 7.9 7.10 Chapter 8 8.1 8.2 Options and Switches ......................................................................... Reasons to Use gcj ............................................................................ Reasons Not to Use gcj ..................................................................... Review ................................................................................................ What You Still Don’t Know .................................................................. Resources .......................................................................................... Know What You Have: CVS .......................................................... What You Will Learn ........................................................................... Source Control: Whys and Hows ........................................................ 185 186 187 187 187 188 189 190 190 8.2.1 8.2.2 8.2.3 8.2.4 8.2.5 8.2.6 8.2.7 8.2.8 8.2.9 8.2.10 8.2.11 Setup ...................................................................................... Import ..................................................................................... Normal Use ............................................................................ Update ................................................................................... Merges ................................................................................... Log ......................................................................................... cvs status ...................................................................... cvs tag .............................................................................. Branching Tags ...................................................................... cvs export ...................................................................... A Quick Look behind the Scenes ........................................... 193 195 198 201 201 203 205 205 207 210 210 8.3 A GUI: jCVS ........................................................................................ 211 8.3.1 Installing jCVS ........................................................................ 211 8.4 8.5 8.6 Review ................................................................................................ What You Still Don’t Know .................................................................. Resources .......................................................................................... 213 214 214 Chapter 9 9.1 9.2 9.3 Ant: An Introduction ..................................................................... What You Will Learn ........................................................................... The Need for a Different Build Tool .................................................... Obtaining and Installing Ant ................................................................ 215 215 216 217 9.3.1 9.3.2 Installing a Binary Tarball ....................................................... Installing a Source Tarball ..................................................... 217 219 9.4 A Sample Ant Buildfile ........................................................................ 220 9.4.1 9.4.2 9.4.3 XML for the Uninitiated .......................................................... The Buildfile Tags .................................................................. A Real, Live Buildfile .............................................................. 220 222 229 9.5 9.6 9.7 Chapter 10 10.1 10.2 Review ................................................................................................ What You Still Don’t Know .................................................................. Resources .......................................................................................... Integrated Development Environments ...................................... What You Will Learn ........................................................................... NetBeans: The Open Source IDE ...................................................... 232 232 232 235 236 236 10.2.1 10.2.2 10.2.3 10.2.4 10.2.5 10.2.6 A Brief History of NetBeans ................................................... Installing NetBeans ................................................................ Getting Around in NetBeans .................................................. Integration with CVS .............................................................. Integration with Ant ................................................................ Other Add-on Tools ................................................................ 236 237 241 245 248 250 10.3 10.4 SunONE Studio Community Edition ................................................... Eclipse: The Source of SWT .............................................................. 251 251 10.4.1 10.4.2 10.4.3 10.4.4 Selecting and Installing Eclipse ............................................. Using Eclipse for a New Project ............................................. Using Eclipse for an Existing Project ..................................... Working with Eclipse .............................................................. 251 254 256 257 10.5 10.6 10.7 Review ................................................................................................ What You Still Don’t Know .................................................................. Resources .......................................................................................... 258 259 259
|