You are previewing Mac OS X for Java Geeks.
O'Reilly logo
Mac OS X for Java Geeks

Book Description

Mac OS X for Java Geeks delivers a complete and detailed look at the Mac OS X platform, geared specifically at Java developers. Programmers using the 10.2 (Jaguar) release of Mac OS X, and the new JDK 1.4, have unprecedented new functionality available to them. Whether you are a Java newbie, working your way through Java Swing and classpath issues, or you are a Java guru, comfortable with digital media, reflection, and J2EE, this book will teach you how to get around on Mac OS X. You'll also get the latest information on how to build applications that run seamlessly, and identically, on Windows, Linux, Unix, and the Mac. The book begins by laying out the Mac OS X tool set, from the included Java Runtime Environment to third-party tools IDEs and Jakarta Ant. You'll then be brought up to speed on the advanced, Mac-specific extensions to Java, including the spelling framework, speech framework, and integration with QuickTime. In addition to clear explanations of these extensions, you'll learn how to write code that falls back to non-Mac specific code when it runs on other platforms, keeping your application portable. Once you have the fundamentals of the Mac OS X Java platform in hand, this book takes you beyond the basics. You'll learn how to get the Apache web server running, and supplement it with the Jakarta Tomcat JSP and servlet container. JSPs and servlets running on Mac OS X are covered, as is installation and connectivity to a database. Once you have your web applications up and running, you'll learn how to interface them with EJBs, as running the JBoss application server on Mac OS X is covered. Finally, the latest developments in web services, including XML-RPC and SOAP, are found within.

Table of Contents

  1. Mac OS X for Java Geeks
    1. Preface
      1. Organization
      2. Conventions Used in This Book
      3. Comments and Questions
      4. Acknowledgments
    2. 1. Getting Oriented
      1. All Those Confusing Names
        1. Mac OS X 10.0
        2. Mac OS X 10.1
        3. Mac OS X 10.1.x
        4. Mac OS X 10.2 (Jaguar)
        5. Beyond Mac OS X 10.2
      2. Why Now?
    3. 2. Apple’s Java Platform
      1. Apple JVM Basics
      2. Apple’s JVM Directory Layout
        1. Libraries
          1. Extensions
          2. The core JVM
        2. The JavaVM.framework Directory
          1. The “real” files
          2. Missing items
        3. The Big Picture
        4. Handling Classpath Issues
      3. Additional APIs and Services
        1. Hardware Acceleration
        2. Multiple Mouse Buttons
        3. Java on Classic (MRJ)
      4. Going Forward
    4. 3. Java Tools
      1. Terminal
        1. Basic Terminal Commands
        2. A Simple Java Class
        3. Environment Variables
      2. Code Editors
        1. Open Source Tools
          1. NetBeans
        2. Free Tools
          1. JBuilder Personal
          2. Project Builder
          3. JavaBrowser
        3. Commercial Tools
          1. Metrowerks CodeWarrior
          2. Macromedia Dreamweaver MX
      3. Jakarta Ant
        1. Installation and Setup
        2. Ant Basics
        3. Running the Build
        4. Ant Documentation
      4. Additional Tools
    5. 4. GUI Applications
      1. Swing and Aqua
        1. A First Look at Aqua
        2. Look and Feel “Gotchas”
          1. Sizing of elements
          2. Background color
          3. Dirty windows
          4. Menu bars
      2. An Example Swing Application
        1. Source Code Listing
        2. The Application API
        3. Initialization
          1. Loading plug-ins
          2. GUI components
          3. Menu bars
          4. Event processing
        4. The SimpleEditPlugin Interface
          1. Writing a plug-in
    6. 5. Apple Extensions
      1. The Mac OS X Finder
        1. Finder Integration
        2. The Finder Plug-in
        3. The FinderIntegration Support Class
          1. Registering handlers
          2. The “About” dialog box
          3. The “Open” and “Preferences” handlers
          4. The “Quit” handler
      2. Native Access
    7. 6. Cross-Platform Programming
      1. GUI Construction
      2. New Line
      3. File Encoding
        1. Enter Unicode
        2. Java, Unicode, and UTF
      4. Threading
      5. File Separator
        1. Class Loader Issues
      6. Testing Cross-Platform Compatibility
        1. File I/O
        2. Preference and Resource Files
        3. Native Code
        4. Native GUI Elements
        5. Threading
      7. For More Information
    8. 7. Standalone Applications
      1. Packaging
        1. Packaging on Windows
        2. Packaging on Mac OS X
      2. JAR Files
        1. Creating a JAR File
        2. Launching the JAR File
      3. Application Bundles
        1. Layout of an Application Bundle
        2. Property List Attributes for Java Applications
          1. About dictionaries
          2. CFBundle dictionary keys
          3. CFBundleDocumentTypes dictionary keys
          4. Java dictionary keys
          5. The Properties dictionary
          6. JDK 1.4.1 rendering
          7. JDK 1.4 full screen display
          8. JDK 1.4 window positioning
        3. Why Use Application Bundles?
      4. Building an Application from Scratch
        1. Directory Layout
        2. Property List
        3. Launcher Stub
        4. Application Icon
        5. Java Libraries
        6. Finder Recognition
      5. MRJAppBuilder
      6. Next Steps
    9. 8. Web-Delivered Applications
      1. Applets
        1. Mac OS X Web Browsers
        2. Creating an Applet
        3. Deploying an Applet
        4. Accessing Mac OS X-Specific Properties from Applets
        5. The Java Applet Plug-in
          1. JAR caching
          2. JAR cache versioning
          3. The Java Plug-in settings application
      2. Java Web Start
        1. Web Start Runtime Environment
        2. Mac OS X Web Start Differences
        3. JAR Resources
        4. Delivering a Web Start Application
        5. Creating a JNLP File
        6. JNLP in Detail
      3. GUI Application Delivery Comparison
      4. Next Steps
    10. 9. The Mac OS X Speech Framework
      1. The Speech API
        1. The Synthesizer Class
        2. Setting Speech Defaults
        3. Speech Recognition
      2. Putting Speech to Work
        1. Getting Set Up
        2. The TalkingJDialog Class
        3. A Talking Dialog Box
        4. Ask Mac OS X
        5. Custom Language Models
    11. 10. QuickTime for Java
      1. Getting Started
        1. Documentation
        2. Class Files
      2. The QuickTime API
        1. Native Origins
          1. The Movie Toolbox
          2. The Image Compression Manager
          3. The Component Manager
          4. Atoms
        2. QuickTime for Java
          1. Understanding the Java bindings
        3. Supported Media Types
      3. The SimplePlayer Application
        1. Imports and Startup
        2. User Interface
        3. Importing Media
        4. Playing a Movie
        5. QuickTime References
        6. Exporting Movies
        7. Running the Player
    12. 11. The Mac OS X Spelling Framework
      1. Getting Set Up
        1. Mac OS X 10.2
        2. Building the Framework
        3. Setting Up the Java Environment
      2. The Spelling API
      3. Spelling in Action
        1. User-Requested Spellchecking
        2. Real-Time Spellchecking
        3. Custom Spellchecking
    13. 12. Databases
      1. Basic Concepts
        1. SQL
      2. Mac OS X Databases
        1. MySQL
          1. Installation
          2. Starting MySQL
          3. Stopping MySQL
          4. Creating a database
          5. Working with a database
          6. MySQL JDBC configuration
        2. PostgreSQL
          1. Installation
          2. Initializing PostgreSQL
          3. Starting PostgreSQL
          4. Stopping PostgreSQL
          5. Creating a database
          6. Working with a database
          7. PostgreSQL JDBC configuration
        3. Oracle 9i
      3. Next Steps
    14. 13. Servlets, JSP, and Tomcat
      1. Apache Tomcat
        1. A Brief History of Tomcat
        2. Installing and Starting Tomcat
        3. Starting Tomcat
        4. Shutting Tomcat Down
        5. Understanding JSP Compilation
        6. Getting to Know Tomcat
          1. bin
          2. common
          3. conf
          4. lib
          5. logs
          6. server/lib
          7. webapps
          8. work
      2. Database-Driven JSP Applications
        1. Setting Up the Database
        2. Building the Web Application
          1. Creating your first JSP
          2. Debugging JSP pages
        3. Talking to the Database
        4. Retrieving Data
        5. Reviewing the Application
      3. Frontending Tomcat with Apache
      4. Next Steps
    15. 14. EJB and JBoss
      1. JBoss
        1. Downloading a Release
        2. Installation
        3. Starting JBoss
      2. Getting Started with J2EE
        1. “Hello World” in J2EE
        2. The JBoss Template Project
          1. Dependencies
          2. The template directory structure
          3. Building from the template application
          4. Adding functionality to the template
      3. Pushing the Envelope
    16. 15. Web Services
      1. RPC
        1. RPC Basics
        2. Java and RPC
      2. XML-RPC
        1. Installation and Setup
        2. XML-RPC Basics
        3. A Simple XML-RPC Application
          1. XML-RPC servers
          2. Synchronous XML-RPC clients
          3. Asynchronous XML-RPC clients
        4. Accessing XML-RPC Services from AppleScript
      3. SOAP
        1. Obtaining Axis
        2. Installation
          1. What is JWS?
          2. Copying the files
        3. SOAP Basics
        4. Building a SOAP Web Service
        5. Accessing a SOAP Web Service from Java
        6. Accessing a SOAP Web Service from AppleScript
      4. Additional Reading
      5. Final Thoughts
    17. Index
    18. Colophon