Java™ application development on linux

Description
1. Java™ Application Development on Linux® 2. Java™ Application Development on Linux® Carl Albing Michael Schwarz Prentice Hall Professional Technical Reference…

Please download to get full document.

View again

of 599
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Information
Category:

Technology

Publish on:

Views: 11 | Pages: 599

Extension: PDF | Download: 0

Share
Transcript
  • 1. Java™ Application Development on Linux®
  • 2. Java™ Application Development on Linux® Carl Albing Michael Schwarz Prentice Hall Professional Technical Reference Boston
  • 3. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals. The authors and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein. The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact: U. S. Corporate and Government Sales (800) 382-3419 corpsales@pearsontechgroup.com For sales outside the U. S., please contact: International Sales international@pearsoned.com Visit us on the Web: www.phptr.com Library of Congress Cataloging-in-Publication Data: CIP data on file. © 2005 Pearson Education, Inc. ISBN 0–13–143697-X Text printed in the United States on recycled paper at Pheonix Color in Hagerstown Maryland. First printing, November 2004
  • 4. To my mother, for her love of words. —Michael To my wife, Cynthia. —Carl
  • 5. xxiPreface .......................................................................................................... xxviiIntroduction ................................................................................................... 1Getting Started ......................................................PART I 3An Embarrassment of Riches: The Linux Environment ............Chapter 1 3What You Will Learn ...........................................................................1.1 4The Command Line: What’s the Big Deal? ........................................1.2 5Basic Linux Concepts and Commands ...............................................1.3 6Redirecting I/O .......................................................................1.3.1 9The ls Command ...................................................................1.3.2 9Filenames ..............................................................................1.3.3 10Permissions ...........................................................................1.3.4 12File Copying ...........................................................................1.3.5 13Seeing Stars ..........................................................................1.3.6 15File Contents ..........................................................................1.3.7 19The grep Command ..............................................................1.3.8 vii Contents
  • 6. 20The find Command ................................................................1.3.9 21The Shell Revisited ................................................................1.3.10 26The tar and zip Commands ...................................................1.3.11 29The man Command ...............................................................1.3.12 30Review ................................................................................................1.4 30What You Still Don’t Know ..................................................................1.5 30Resources ..........................................................................................1.6 33An Embarrassment of Riches: Editors .......................................Chapter 2 33What You Will Learn ...........................................................................2.1 34Eye to Eye with vi ...............................................................................2.2 40Exiting ....................................................................................2.2.1 41Search and Replace ..............................................................2.2.2 43The Joy of Regular Expressions ............................................2.2.3 44Starting Off Right: .exrc .....................................................2.2.4 45Editors Galore .....................................................................................2.3 47Editing Your Pipes (sed, the Stream EDitor) .........................2.3.1 47Simple Graphical Editors .......................................................2.3.2 49Review ................................................................................................2.4 49What You Still Don’t Know ..................................................................2.5 49Resources ..........................................................................................2.6 51An Experienced Programmer’s Introduction to Java ................Chapter 3 51What You Will Learn ...........................................................................3.1 52Fundamental Language Elements ......................................................3.2 53Scalar Types ..........................................................................3.2.1 57Object Types ..........................................................................3.2.2 65Statements .............................................................................3.2.3 74Error Handling, Java Style .....................................................3.2.4 78print(), println(), printf() ...............................3.2.5 82Using (and Making) Java APIs ...........................................................3.3 82The package Statement .....................................................3.3.1 84The import Statement .......................................................3.3.2 85Encapsulation, Inheritance, and Polymorphism .................................3.4 85Encapsulation ........................................................................3.4.1 86Inheritance .............................................................................3.4.2 Contentsviii
  • 7. 91Polymorphism ........................................................................3.4.3 93O, Templates! Where Art Thou? .........................................................3.5 94Virtually Final ......................................................................................3.6 95A Useful Simple Application ...............................................................3.7 95Review ................................................................................................3.8 97What You Still Don’t Know ..................................................................3.9 97Resources ..........................................................................................3.10 98Exercises ............................................................................................3.11 99Where Am I? Execution Context ..................................................Chapter 4 100What You Will Learn ...........................................................................4.1 100A Simple Start .....................................................................................4.2 100Command-Line Arguments ....................................................4.2.1 102Unit Testing Made Easy .........................................................4.2.2 102The System Class ...........................................................................4.3 102Java and Standard I/O ...........................................................4.3.1 104Environment Variables ...........................................................4.3.2 105Java and Environment Variables ...........................................4.3.3 109The Properties Class .................................................................4.4 111The Runtime Class .........................................................................4.5 111exec() ................................................................................4.5.1 113Portability ...............................................................................4.5.2 113Review ................................................................................................4.6 113What You Still Don’t Know ..................................................................4.7 114Resources ..........................................................................................4.8 115The Sun Microsystems Java Software Development Kit ...........Chapter 5 116What You Will Learn ...........................................................................5.1 116All You Need, and Not One Thing More .............................................5.2 117The Java Compiler .............................................................................5.3 117Compiler Behavior, Defaults, and Environment Variables .....5.3.1 119javac Options .........................................................................5.3.2 121The Java Runtime Engine ..................................................................5.4 121The Basics .............................................................................5.4.1 122java Options ...........................................................................5.4.2 122Complete, Up-to-Date Program Documentation Made Easy ..............5.5 ixContents
  • 8. 123Running javadoc ...................................................................5.5.1 124Javadoc Command-Line Options ...........................................5.5.2 128Javadoc Comments ...............................................................5.5.3 131Dispensing with Applets .....................................................................5.6 132Going Native .......................................................................................5.7 137Introducing RMI ..................................................................................5.8 137A Brief Introduction to RMI .....................................................5.8.1 143The rmic Tool ........................................................................5.8.2 144The rmiregistry Tool .............................................................5.8.3 144Setting Up Servers and Clients ..............................................5.8.4 147RMI Summary ........................................................................5.8.5 148The Java Debugger ............................................................................5.9 157Return to the Source: The Java Decompiler ......................................5.10 157Bundling a Java Program: Put It in a JAR ..........................................5.11 160Deploying Applications ...........................................................5.11.1 163Basic jar Operation ................................................................5.11.2 164The Rest of the Toolkit .......................................................................5.12 166Review ................................................................................................5.13 166What You Still Don’t Know ..................................................................5.14 166Resources ..........................................................................................5.15 167The IBM Developer Kit for Linux, Java 2 Technology Edition ...Chapter 6 167What You Will Learn ...........................................................................6.1 168 Use Linux Features to Make Multiple Java SDKs Play Nicely Together ............................................................................................. 6.2 168Links .......................................................................................6.2.1 173Switching Java Versions by Symlink ......................................6.2.2 174How the IBM JDK Differs from the Sun JDK ......................................6.3 175Performance ..........................................................................6.3.1 175Differences in the Commands ................................................6.3.2 175IBM Classes ...........................................................................6.3.3 176What Are All These “_g” Versions? ....................................................6.4 176Review ................................................................................................6.5 177What You Still Don’t Know ..................................................................6.6 177Resources ..........................................................................................6.7 Contentsx
  • 9. 179The GNU Compiler for Java (gcj) .................................................Chapter 7 179What You Will Learn ...........................................................................7.1 179A Brand GNU Way .............................................................................7.2 180The GNU Compiler Collection ............................................................7.3 181Compiling Our Simple Application with gcj ........................................7.4 182Compiling FetchURL with gcj ................................................7.4.1 184Compiling a Multiclass Program ............................................7.4.2 185Options and Switches .........................................................................7.5 186Reasons to Use gcj ............................................................................7.6 187Reasons Not to Use gcj .....................................................................7.7 187Review ................................................................................................7.8 187What You Still Don’t Know ..................................................................7.9 188Resources ..........................................................................................7.10 189Know What You Have: CVS ..........................................................Chapter 8 190What You Will Learn ...........................................................................8.1 190Source Control: Whys and Hows ........................................................8.2 193Setup ......................................................................................8.2.1 195Import .....................................................................................8.2.2 198Normal Use ............................................................................8.2.3 201Update ...................................................................................8.2.4 201Merges ...................................................................................8.2.5 203Log .........................................................................................8.2.6 205cvs status ......................................................................8.2.7 205cvs tag ..............................................................................8.2.8 207Branching Tags ......................................................................8.2.9 210cvs export ......................................................................8.2.10 210A Quick Look behind the Scenes ...........................................8.2.11 211A GUI: jCVS ........................................................................................8.3 211Installing jCVS ........................................................................8.3.1 213Review ................................................................................................8.4 214What You Still Don’t Know ..................................................................8.5 214Resources ..........................................................................................8.6 xiContents
  • 10. 215Ant: An Introduction .....................................................................Chapter 9 215What You Will Learn ...........................................................................9.1 216The Need for a Different Build Tool ....................................................9.2 217Obtaining and Installing Ant ................................................................9.3 217Installing a Binary Tarball .......................................................9.3.1 219Installing a Source Tarball .....................................................9.3.2 220A Sample Ant Buildfile ........................................................................9.4 220XML for the Uninitiated ..........................................................9.4.1 222The Buildfile Tags ..................................................................9.4.2 229A Real, Live Buildfile ..............................................................9.4.3 232Review ................................................................................................9.5 232What You Still Don’t Know ..................................................................9.6 232Resources ..........................................................................................9.7 235Integrated Development Environments ......................................Chapter 10 236What You Will Learn ...........................................................................10.1 236NetBeans: The Open Source IDE ......................................................10.2 236A Brief History of NetBeans ...................................................10.2.1 237Installing NetBeans ................................................................10.2.2 241Getting Around in NetBeans ..................................................10.2.3 245Integration with CVS ..............................................................10.2.4 248Integration with Ant ................................................................10.2.5 250Other Add-on Tools ................................................................10.2.6 251SunONE Studio Community Edition ...................................................10.3 251Eclipse: The Source of SWT ..............................................................10.4 251Selecting and Installing Eclipse .............................................10.4.1 254Using Eclipse for a New Project .............................................10.4.2 256Using Eclipse for an Existing Project .....................................10.4.3 257Working with Eclipse ..............................................................10.4.4 258Review ................................................................................................10.5 259What You Still Don’t Know ..................................................................10.6 259Resources ..........................................................................................10.7 Contentsxii
  • 11. 261Developing Business Logic .................................PART II 263Balancing Acts: An Imaginary Scenario .....................................Chapter 11 263What You Will Learn ...........................................................................11.1 264Statement of the Need ........................................................................11.2 264How to Develop Software ...................................................................11.3 267What Makes a Good Requirement .....................................................11.4 268Whom to Ask for Requirements ..........................................................11.5 269Requirements for the Budget Application ...........................................11.6 269Monday Morning, 10 A.M. ......................................................11.6.1 272Back at His Desk ....................................................................11.6.2 272Documenting, Prototyping, and Stakeholder Buy-In ...........................11.7 272Documenting .
  • Related Search
    Similar documents
    View more...
    We Need Your Support
    Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

    Thanks to everyone for your continued support.

    No, Thanks