Home Page Icon
Home Page
Table of Contents for
I. Getting Started
Close
I. Getting Started
by Michael Schwarz, Carl Albing
Java™ Application Development on Linux®
Copyright
Dedication
Bruce Peren's Open Source Series
Preface
Java and Linux
Free Software and Java
You Can Help!
Acknowledgments
Introduction
Who Should Buy This Book
Who Should Not Buy This Book
How to Use This Book
Many Paths
The Linux Newbie Path
The Java Newbie Path
The Client-Side Path
The Server-Side Path
The Enterprise Path
I. Getting Started
1. An Embarrassment of Riches: The Linux Environment
1.1. What You Will Learn
1.2. The Command Line: What’s the Big Deal?
1.3. Basic Linux Concepts and Commands
1.3.1. Redirecting I/O
1.3.1.1. Standard I/O
1.3.1.2. Pipes
1.3.2. The ls Command
1.3.3. Filenames
1.3.4. Permissions
1.3.5. File Copying
1.3.6. Seeing Stars
1.3.6.1. Escape at Last
1.3.7. File Contents
1.3.8. The grep Command
1.3.9. The find Command
1.3.10. The Shell Revisited
1.3.11. The tar and zip Commands
1.3.12. The man Command
1.4. Review
1.5. What You Still Don’t Know
1.6. Resources
2. An Embarrassment of Riches: Editors
2.1. What You Will Learn
2.2. Eye to Eye with vi
2.2.1. Exiting
2.2.2. Search and Replace
2.2.3. The Joy of Regular Expressions
2.2.4. Starting Off Right: .exrc
2.3. Editors Galore
2.3.1. Editing Your Pipes (sed, the Stream EDitor)
2.3.2. Simple Graphical Editors
2.4. Review
2.5. What You Still Don’t Know
2.6. Resources
3. An Experienced Programmer’s Introduction to Java
3.1. What You Will Learn
3.2. Fundamental Language Elements
3.2.1. Scalar Types
3.2.1.1. Integer Types
3.2.1.2. Floating Point Types
3.2.1.3. Other Types
3.2.1.4. Operators
3.2.1.5. Arrays
3.2.2. Object Types
3.2.2.1. Objects as References
3.2.2.2. Strings
3.2.2.3. Other Classes: Reading Javadoc
3.2.3. Statements
3.2.3.1. Conditional Execution
The if-else statement
The switch statement
3.2.3.2. Looping and Related Statements
The while statement
The do-while loop
The for loop
The for loop with iterators
The break and continue statements
3.2.3.3. The return statement
3.2.4. Error Handling, Java Style
3.2.5. print(), println(), printf()
3.3. Using (and Making) Java APIs
3.3.1. The package Statement
3.3.2. The import Statement
3.4. Encapsulation, Inheritance, and Polymorphism
3.4.1. Encapsulation
3.4.2. Inheritance
3.4.2.1. Inheritance and Encapsulation
3.4.2.2. The static statement
3.4.2.3. The final statement
3.4.3. Polymorphism
3.5. O, Templates! Where Art Thou?
3.6. Virtually Final
3.7. A Useful Simple Application
3.8. Review
3.9. What You Still Don’t Know
3.10. Resources
3.11. Exercises
4. Where Am I? Execution Context
4.1. What You Will Learn
4.2. A Simple Start
4.2.1. Command-Line Arguments
4.2.2. Unit Testing Made Easy
4.3. The System Class
4.3.1. Java and Standard I/O
4.3.2. Environment Variables
4.3.3. Java and Environment Variables
4.4. The Properties Class
4.5. The Runtime Class
4.5.1. exec()
4.5.2. Portability
4.6. Review
4.7. What You Still Don’t Know
4.8. Resources
5. The Sun Microsystems Java Software Development Kit
5.1. What You Will Learn
5.2. All You Need, and Not One Thing More
5.3. The Java Compiler
5.3.1. Compiler Behavior, Defaults, and Environment Variables
5.3.2. javac Options
5.4. The Java Runtime Engine
5.4.1. The Basics
5.4.2. java Options
5.5. Complete, Up-to-Date Program Documentation Made Easy
5.5.1. Running javadoc
5.5.2. Javadoc Command-Line Options
5.5.3. Javadoc Comments
5.6. Dispensing with Applets
5.7. Going Native
5.8. Introducing RMI
5.8.1. A Brief Introduction to RMI
5.8.1.1. History and Background
5.8.1.2. RMI Basics
5.8.1.3. Writing the Interface
5.8.1.4. Writing the Server Class
5.8.1.5. Writing the Client Class
5.8.2. The rmic Tool
5.8.3. The rmiregistry Tool
5.8.4. Setting Up Servers and Clients
5.8.4.1. What RMI Servers and Clients Need to Be Able to Do
5.8.4.2. Our Environment
5.8.4.3. Compiling and Running the Server
5.8.4.4. Compiling and Running the Client
5.8.5. RMI Summary
5.9. The Java Debugger
5.10. Return to the Source: The Java Decompiler
5.11. Bundling a Java Program: Put it in a JAR
5.11.1. Deploying Applications
5.11.1.1. The Manifest File
5.11.1.2. Putting a Compiled Application in a JAR File
5.11.2. Basic jar Operation
5.12. The Rest of the Toolkit
5.13. Review
5.14. What You Still Don’t Know
5.15. Resources
6. The IBM Developer Kit for Linux, Java 2 Technology Edition
6.1. What You Will Learn
6.2. Use Linux Features to Make Multiple Java SDKs Play Nicely Together
6.2.1. Links
6.2.1.1. Hard Links
6.2.1.2. Symbolic Links, or Symlinks
6.2.2. Switching Java Versions by Symlink
6.3. How the IBM JDK Differs from the Sun JDK
6.3.1. Performance
6.3.2. Differences in the Commands
6.3.3. IBM Classes
6.4. What Are All These “_g” Versions?
6.5. Review
6.6. What You Still Don’t Know
6.7. Resources
7. The GNU Compiler for Java (gcj)
7.1. What You Will Learn
7.2. A Brand GNU Way
7.3. The GNU Compiler Collection
7.4. Compiling Our Simple Application with gcj
7.4.1. Compiling FetchURL with gcj
7.4.2. Compiling a Multiclass Program
7.5. Options and Switches
7.6. Reasons to Use gcj
7.7. Reasons Not to Use gcj
7.8. Review
7.9. What You Still Don’t Know
7.10. Resources
8. Know What You Have: CVS
8.1. What You Will Learn
8.2. Source Control: Whys and Hows
8.2.1. Setup
8.2.2. Import
8.2.3. Normal Use
8.2.4. Update
8.2.5. Merges
8.2.6. Log
8.2.7. cvs status
8.2.8. cvs tag
8.2.9. Branching Tags
8.2.10. cvs export
8.2.11. A Quick Look behind the Scenes
8.3. A GUI: jCVS
8.3.1. Installing jCVS
8.4. Review
8.5. What You Still Don’t Know
8.6. Resources
9. Ant: An Introduction
9.1. What You Will Learn
9.2. The Need for a Different Build Tool
9.3. Obtaining and Installing Ant
9.3.1. Installing a Binary Tarball
9.3.1.1. Environment Variables
9.3.2. Installing a Source Tarball
9.4. A Sample Ant Buildfile
9.4.1. XML for the Uninitiated
9.4.2. The Buildfile Tags
9.4.2.1. The project Tag
9.4.2.2. The target Tag
9.4.2.3. Properties
9.4.2.4. Tasks
Standard task attributes
The javac task
The jar task
The javadoc task
The copy and mkdir tasks
The rmic task
9.4.2.5. Other Tags
The PatternSet, Include, and Exclude datatypes
Other datatypes
9.4.3. A Real, Live Buildfile
9.4.3.1. Project Organization
9.4.3.2. The build.xml File for Payback
9.5. Review
9.6. What You Still Don’t Know
9.7. Resources
10. Integrated Development Environments
10.1. What You Will Learn
10.2. NetBeans: The Open Source IDE
10.2.1. A Brief History of NetBeans
10.2.2. Installing NetBeans
10.2.2.1. Downloading
10.2.2.2. Installing
10.2.2.3. Running
10.2.3. Getting Around in NetBeans
10.2.3.1. Filesystem versus Project
10.2.3.2. Editing
10.2.4. Integration with CVS
10.2.5. Integration with Ant
10.2.6. Other Add-on Tools
10.3. SunONE Studio Community Edition
10.4. Eclipse: The Source of SWT
10.4.1. Selecting and Installing Eclipse
10.4.2. Using Eclipse for a New Project
10.4.3. Using Eclipse for an Existing Project
10.4.4. Working with Eclipse
10.5. Review
10.6. What You Still Don’t Know
10.7. Resources
II. Developing Business Logic
11. Balancing Acts: An Imaginary Scenario
11.1. What You Will Learn
11.2. Statement of the Need
11.3. How to Develop Software
11.4. What Makes a Good Requirement
11.5. Whom to Ask for Requirements
11.6. Requirements for the Budget Application
11.6.1. Monday Morning, 10 A.M.
11.6.2. Back at His Desk
11.7. Documenting, Prototyping, and Stakeholder Buy-In
11.7.1. Documenting
11.7.2. Stakeholder Buy-In
11.7.3. Prototyping
11.8. Review
11.9. What You Still Don’t Know
11.10. Resources
11.11. Exercises
12. Analysis and Design: Seeking the Objects
12.1. What You Will Learn
12.2. Facing the Blank Page
12.3. Using CRC Cards
12.4. Finding the Objects
12.5. Finding the Methods and Attributes
12.6. Essential and Nonessential
12.7. Analysis Paralysis
12.8. Real Software Engineering
12.9. Core Classes
12.10. Review
12.11. What You Still Don’t Know
12.12. Resources
12.13. Exercises
13. JUnit: Automating Unit Testing
13.1. What You Will Learn
13.2. JUnit: Why All the Fuss?
13.3. Design Then Test Then Code
13.4. Installing and Running JUnit
13.4.1. Downloading and Unzipping
13.4.2. Using JUnit
13.5. Writing Test Cases
13.5.1. JUnit Assertions
13.5.2. Running a Test Case
13.6. Running Test Suites
13.7. Review
13.8. What You Still Don’t Know
13.9. Resources
13.10. Exercises
14. Storing the Data
14.1. What You Will Learn
14.2. Follow the Objects
14.3. Of Persistence
14.4. Thinking of the Future, or Painting in Corners
14.5. Oracle, PostgreSQL, MySQL
14.5.1. MySQL
14.5.2. PostgreSQL
14.5.3. Oracle
14.5.4. Selection Criteria
14.6. Being Self-Contained
14.7. Beyond the Basics
14.8. Persistence Is Not the Whole Story
14.9. Setting Up PostgreSQL for BudgetPro
14.9.1. Installing PostgreSQL
14.9.2. Creating a postgres User
14.9.3. Creating Our Database
14.9.4. Straight JDBC
14.9.4.1. Static Account Members
14.9.4.2. Joining the User
14.10. Review
14.11. What You Still Don’t Know
14.12. Resources
14.13. Exercises
15. Accessing the Data: An Introduction to JDBC
15.1. What You Will Learn
15.2. Introducing JDBC
15.3. Making Connections
15.3.1. Downloading JDBC for MySQL
15.4. Querying Data
15.5. Getting Results
15.6. Updates, Inserts, Deletes
15.7. Review
15.8. What you Still Don’t Know
15.9. Resources
15.10. Exercises
III. Developing Graphical User Interfaces
16. Getting in the Swing of Things: Designing a GUI for BudgetPro
16.1. What You Will Learn
16.2. A Simple Swing Program
16.3. Stompin’ at the Savoy, or The Swing Paradigm
16.4. Slow, Slow, Quick-Quick, Slow: The Basic Swing Objects
16.5. Layout Managers
16.6. Beyond Arthur Murray: Actions, Listeners, Events
16.7. Getting Down to Cases: Designing a GUI for BudgetPro
16.7.1. Overview
16.7.1.1. Instance Variables
16.7.1.2. Main
16.7.2. Creating Pieces
16.7.2.1. Simple JLabels
16.7.2.2. FlowLayout
16.7.2.3. BoxLayout
16.7.2.4. JButtons
16.7.2.5. Actions for Buttons
16.7.2.6. The createStatus() Revisited
16.7.2.7. JTable: The Workhorse of Data Display
16.7.2.8. Table Model
16.7.2.9. Renderers
16.7.2.10. Selection Listeners
16.7.2.11. Ready, aim, fire!
16.7.2.12. Scrolling
16.7.2.13. Dialogs
16.8. Review
16.9. What You Still Don’t Know
16.10. Resources
16.11. Exercises
17. Other Ways: Alternatives to Swing
17.1. What You Will Learn
17.2. The IBM SWT Toolkit
17.2.1. Another GUI Toolkit. Why?
17.2.2. Duplicated Effort. Why Cover It?
17.2.3. Portability: Better and Worse
17.2.4. The Rest of the Chapter
17.2.5. SWT: Close to the Metal
17.2.6. “Hello, world” SWT Style
17.2.6.1. Setting Up to Run an SWT Application
17.2.6.2. Anatomy of an SWT Application
17.3. Porting BudgetPro to SWT
17.3.1. Step 1: Convert the Class Members
17.3.2. Step 2: Converting the main() Method
17.3.3. Step 3: Converting the GUI build() and init() Methods
17.3.3.1. Converting the GUI build() Method
17.3.3.2. Converting the GUI init() Method
17.3.3.3. Reworking Event Handlers
17.3.4. Completing the Conversion of the BudgetPro Class
17.3.4.1. The Table, TableColumn, and TableItem Classes
17.3.5. Completing the Conversion of the Application
17.3.6. Closing Thoughts
17.4. SWT and gcj
17.5. Review
17.6. What You Still Don’t Know
17.7. Resources
17.8. Exercises
IV. Developing Web Interfaces
18. Servlets: Java Pressed into Service
18.1. What You Will Learn
18.2. Servlets: Program-Centric Server-Side Documents
18.3. Perspective
18.4. How to Write a Servlet
18.5. Input, Output
18.6. Matters of State: Cookies, Hidden Variables, and the Dreaded “Back” Button
18.6.1. Cookies
18.7. Designing a BudgetPro Servlet
18.7.1. Prototype
18.7.2. Design
18.8. Review
18.9. What You Still Don’t Know
18.10. Resources
18.11. Exercises
19. JSP: Servlets Turned Inside Out
19.1. What You Will Learn
19.2. Servlets Turned Inside Out: JSP
19.3. How to Write a JSP Application
19.3.1. Scriptlet
19.3.2. Declaration
19.3.3. Expression
19.3.4. Directive
19.3.5. New Syntax
19.3.6. JavaBeans in JSP
19.3.7. Tag Libraries
19.4. Using JSP with BudgetPro
19.5. Review
19.6. What You Still Don’t Know
19.7. Resources
19.8. Exercises
20. Open Source Web Application Servers
20.1. What You Will Learn
20.2. Downloading JBoss
20.3. Be an Enabler, or “Let’s Be Codependent!”
20.3.1. Nonroot-Installed Software
20.3.2. Finer Grained Control
20.4. Installing JBoss
20.5. Things That Make It Go
20.5.1. System V Init System
20.5.2. RedHat/Fedora chkconfig
20.5.3. Other Distributions
20.5.4. IDE Integration
20.6. Disposition of Forces
20.7. Apache Geronimo
20.8. Installing Geronimo
20.9. Running the Geronimo Server
20.10. Review
20.11. What You Still Don’t Know
20.12. Resources
V. Developing Enterprise Scale Software
21. Introduction to Enterprise JavaBeans
21.1. What You Will Learn
21.2. Expanding to EJBs
21.2.1. EJB Concepts
21.2.1.1. The Life Cycle of an Enterprise JavaBean
Creation
Destruction
Passivation and activation
Context switching
21.2.1.2. The EJB Container
21.2.2. Bean Types
21.2.2.1. Session Beans
Stateless Session Beans
What they are
Why you would use them
Stateful Session Beans
What they are
Why you would use them
21.2.2.2. Entity Beans
What they are
Why you would use them
21.2.2.3. Message Beans
What they are
Why you would use them
21.2.3. Under the Hood
21.3. What’s in a Name? An Introduction to JNDI
21.3.1. Naming and Directory System Concepts
21.3.2. Common Directory Services
21.3.2.1. Domain Name Service (DNS)
21.3.2.2. Filesystems
21.3.2.3. LDAP
21.3.2.4. Novell Directory Service (NDS)
21.3.2.5. Microsoft’s Active Directory
21.3.3. Putting a Face to a Name: JNDI
21.3.3.1. A Sample JNDI Program
The GetDomain main() method
Establishing an initial context
Going from the initial context to a DNS entry
21.3.3.2. Learning More about JNDI
21.3.4. Using JNDI with JBoss
21.4. Review
21.5. What You Still Don’t Know
21.6. Resources
22. Building an EJB
22.1. What You Will Learn
22.2. EJBs: You Don’t Know Beans?
22.2.1. SessionBean
22.2.2. EJBObject
22.2.3. EJBHome
22.2.4. Summarizing the Pieces
22.2.5. EJBLocalHome and EJBLocalObject
22.2.6. Compiling Your Beans
22.3. Review
22.4. What You Still Don’t Know
22.5. Resources
23. Deploying EJBs
23.1. What you Will Learn
23.2. Lend Me Your EAR: Enterprise Packaging and Deployment
23.2.1. What’s in an EJB-JAR File
23.2.2. Using Our Bean
23.2.3. Packaging the Servlet
23.2.3.1. What is in the WAR File
23.2.3.2. Weaving the Web
23.2.3.3. Connecting the Pieces
23.3. Deploying the EAR
23.3.1. JBoss
23.3.2. Geronimo
23.4. Maintaining a Distributed Application
23.4.1. Ant and CVS
23.4.2. XDoclet
23.5. Abstracting Legacy Applications
23.6. Review
23.7. What you Still Don’t Know
23.8. Resources
24. Parting Shots
24.1. The Future’s So Bright, I Squint and Look Confused
24.2. Our Book Is Yours
24.3. Came the Revolution
24.4. What You Still Don’t Know
24.5. Resources
A. ASCII Chart
B. A Java Swing GUI for BudgetPro
C. GNU General Public License
Preamble
Terms and Conditions for Copying, Distribution, and Modification
No Warranty
How to Apply these Terms to Your New Programs
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Introduction
Next
Next Chapter
1. An Embarrassment of Riches: The Linux Environment
Part I. Getting Started
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset