Java™ Application Development on Linux®
Read it now on the O’Reilly learning platform with a 10-day free trial.
O’Reilly members get unlimited access to books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.
Book description
Linux is the fastest-growing Java development platform because it saves money and time by serving as a platform for both development and deployment. But developers face significant platform-specific challenges when managing and deploying Java applications in a controlled production environment.
Written for Java and Linux developers alike, Java™ Application Development on Linux®is the hands-on guide to the full Java application development lifecycle on Linux.
Determined to spare other developers hours of trial and error, Albing and Schwarz demonstrate the platform, tools, and application development by showing realistic, easy-to-follow examples. After a simple command-line application introduces basic tools, this program leads readers through business-logic object analysis, database design, Java servlet UIs, Java Server Pages (JSP) UIs, Swing GUIs, and Standard Widget Toolkit (SWT) GUIs. Scaling up to the enterprise level provides the opportunity to use both the JBoss Application Server and the Apache Geronimo Application Servers, and Enterprise JavaBeans (EJB).
Readers learn how to
- Use development tools available on Linux, such as the GNU Compiler for Java (gcj), Ant, the NetBeans IDE, IBM's Eclipse Java IDE, JUnit, and SunONE Studio
- Develop business logic layers using Java DataBase Connectivity (JDBC)
- Add a Web interface using servlets and JSPs
- Add a GUI using Sun's Abstract Window Toolkit (AWT) and IBM's SWT
The authors conclude by demonstrating how a hierarchy of budgets can be created, tracked, and shared with Concurrent Versions System (CVS).
A companion Website includes all source code and a link to each tool described.
Java™ Application Development on Linux® can propel you from a standing start to the full-speed development and deployment of Java applications on Linux.
Show and hide more
Table of contents Product information
Table of contents
- Copyright
- Dedication
- Java and Linux
- Free Software and Java
- You Can Help!
- Acknowledgments
- 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
- 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.6.1. Escape at Last
- 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.1. Editing Your Pipes (sed, the Stream EDitor)
- 2.3.2. Simple Graphical Editors
- 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.1. Objects as References
- 3.2.2.2. Strings
- 3.2.2.3. Other Classes: Reading Javadoc
- 3.2.3.1. Conditional Execution
- The if-else statement
- The switch statement
- The while statement
- The do-while loop
- The for loop
- The for loop with iterators
- The break and continue statements
- 3.3.1. The package Statement
- 3.3.2. The import Statement
- 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
- 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.1. Java and Standard I/O
- 4.3.2. Environment Variables
- 4.3.3. Java and Environment Variables
- 4.5.1. exec()
- 4.5.2. Portability
- 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.1. The Basics
- 5.4.2. java Options
- 5.5.1. Running javadoc
- 5.5.2. Javadoc Command-Line Options
- 5.5.3. Javadoc Comments
- 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.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.11.1. Deploying Applications
- 5.11.1.1. The Manifest File
- 5.11.1.2. Putting a Compiled Application in a JAR File
- 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.3.1. Performance
- 6.3.2. Differences in the Commands
- 6.3.3. IBM Classes
- 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
- 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.1. Installing jCVS
- 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.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
- The PatternSet, Include, and Exclude datatypes
- Other datatypes
- 9.4.3.1. Project Organization
- 9.4.3.2. The build.xml File for Payback
- 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.1. Filesystem versus Project
- 10.2.3.2. Editing
- 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
- 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.1. Documenting
- 11.7.2. Stakeholder Buy-In
- 11.7.3. Prototyping
- 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.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.1. JUnit Assertions
- 13.5.2. Running a Test Case
- 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.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
- 15.1. What You Will Learn
- 15.2. Introducing JDBC
- 15.3. Making Connections
- 15.3.1. Downloading JDBC for MySQL
- 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.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
- 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.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.1. The Table, TableColumn, and TableItem Classes
- 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.1. Prototype
- 18.7.2. Design
- 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
- 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.5.1. System V Init System
- 20.5.2. RedHat/Fedora chkconfig
- 20.5.3. Other Distributions
- 20.5.4. IDE Integration
- 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.2.1. Session Beans
- Stateless Session Beans
- What they are
- Why you would use them
- What they are
- Why you would use them
- What they are
- Why you would use them
- What they are
- Why you would use them
- 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.1. A Sample JNDI Program
- The GetDomain main() method
- Establishing an initial context
- Going from the initial context to a DNS entry
- 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
- 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.1. JBoss
- 23.3.2. Geronimo
- 23.4.1. Ant and CVS
- 23.4.2. XDoclet
- 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
- Preamble
- Terms and Conditions for Copying, Distribution, and Modification
- No Warranty
- How to Apply these Terms to Your New Programs
Show and hide more
Product information
- Title: Java™ Application Development on Linux®
- Author(s): Carl Albing, Michael Schwarz
- Release date: November 2004
- Publisher(s): Pearson
- ISBN: 013143697X