Java 2 Micro Edition
James P. White and David A. Hemphill
  • March 2002
  • ISBN 9781930110335
  • 504 pages

Java2, Micro Edition (J2ME) is a technology defined by many specifications. These specifications help J2ME address the diverse needs of this wide spectrum of consumer products. This guide describes the architecture of J2ME and demonstrates the various specifications for programming Java applications.

About the book

Through the use of a tutorial application and various programming examples, the common elements of most applications, namely user interface, event handling, data storage, networking, and input/output are examined. Also covered are design considerations when building software for resource-constrained devices as well as J2ME competition and associated technologies in these devices.

Tutorial and API example application source code are available to download.

Table of Contents detailed table of contents


Part I Developing with J2ME

1. Introduction

1.1. So what is J2ME anyway?

1.1.1. Where is J2ME being applied?

1.2. What is a small device?

1.2.1. The vast consumer space

1.2.2. Consumer electronic and embedded devices

1.3. J2ME’s role in wireless and mobile applications

1.3.1. Is J2ME mobile?

1.3.2. Is J2ME wireless?

1.3.3. Wireless vs. mobile

1.4. The Java 2 edition trilogy

1.4.1. J2SE

1.4.2. J2EE

1.4.3. J2ME

1.4.4. Why we need J2ME

1.5. The case for Java

1.5.1. Is Java right for small devices?

1.5.2. Java’s beneficial features

1.6. Origins of J2ME

1.6.1. Java’s origins

1.6.2. The return of Java in small devices

1.7. The J2ME community

1.7.1. J2ME’s guiding light, the Java Community Process

1.8. J2ME products and alternatives

1.9. Summary

2. J2ME Architecture

2.1. Goals of the J2ME architecture

2.1.1. Support for multiple devices

2.1.2. Support for device-specific functionality

2.1.3. Maintaining a common architecture

2.2. Accommodating opposing needs

2.2.1. Configurations and profiles

2.2.2. A high-level view of J2ME

2.3. Configurations: a closer look

2.3.1. Connected Limited Device Configuration (CLDC)

2.3.2. The Kilobyte Virtual Machine (KVM)

2.3.3. Connected Device Configuration (CDC)

2.3.4. C-Virtual Machine (CVM)

2.4. Profiles: a closer look

2.4.1. Two types of profiles

2.4.2. Profiles are modular

2.4.3. J2ME profiles extend J2ME configurations

2.5. Choosing a J2ME profile

2.5.1. Mobile Information Device Profile (MIDP)

2.5.2. PDA Profile (PDAP)

2.5.3. Foundation Profile

2.5.4. Personal Profile

2.5.5. RMI Profile

2.5.6. Personal Basis Profile

2.5.7. Multimedia Profile

2.5.8. Gaming Profile

2.5.9. Wireless Telephony Communications API (WTCA)

2.5.10. KJava

2.6. Write once, run anywhere issues

2.6.1. Varied device needs

2.6.2. J2ME architecture increases WORA

2.7. Runtime environment

2.8. Designing J2ME applications

2.9. Summary

3. Developing a J2ME Application

3.1. Investment quote application requirements

3.1.1. The investment quote application customer

3.1.2. Requirements analysis

3.2. Designing the investment quote application

3.2.1. Application control

3.2.2. User interface design

3.2.3. Persistent storage

3.2.4. Networking and input/output

3.3. Developing J2ME applications

3.3.1. Obtaining the development environment

3.3.2. Creating the applications

3.3.3. Runtime environment

3.4. Investment quote application tour guide

3.5. Summary

Part II Developing for Cellular Phones and Pagers

4. A Simple MIDP Application

4.1. Questions about the MIDP development environment

4.1.1. Can I do this without an actual device?

4.1.2. What device do I start with?

4.1.3. Do I have to use the command line tools?

4.1.4. The example: what are we going to do?

4.2. Developing MIDP applications

4.2.1. Getting started

4.2.2. What is a MIDlet?

4.2.3. Compiling the application

4.2.4. Preverifying the application

4.2.5. Running the application

4.2.6. Troubleshooting

4.2.7. JARing MIDlets

4.2.8. Developing MIDlet suites

4.2.9. Running MIDlet suites from a web server

4.2.10. Installing MIDlet suites locally

4.3. Summary

5. MIDP User InterfaceSource

5.1. MIDP application control

5.2. The investment quote application control in MIDP

5.3. Two types of MIDP user interface and event handling

5.3.1. High-level API

5.3.2. Low-level API

5.4. The MIDP user interface API

5.4.1. MIDP display control

5.4.2. MIDP high-level user interface API

5.4.3. MIDP low-level user interface API

5.4.4. The investment quote application’s user interface in MIDP

5.5. Handling user interactions in MIDP

5.5.1. High-level event handling

5.5.2. Low-level event handling

5.5.3. Handling the events of the Investment Quote Application

5.6. MIDlets on other devices

5.7. Summary

6. MIDP Data Storage

6.1. JDBC parallel

6.2. Storage structure

6.2.1. Record store

6.2.2. Records in the record store

6.3. RMS API

6.3.1. Record store construction and access

6.3.2. Record store exceptions

6.3.3. Record store listener

6.3.4. Comparing records

6.3.5. Filtering records

6.3.6. Enumerating through records

6.4. Persistent storage in the investment quote application

6.4.1. Defining the stock/mutual fund record

6.4.2. Storing quotes

6.4.3. Retrieving quotes

6.5. Summary

7. Connecting to the Internet

7.1. Micro edition package connectivity

7.1.1. Using the Connector class to open a channel

7.2. Similar but smaller I/O package

7.2.1. Streams

7.2.2. Readers/Writers

7.3. Implementing the Internet investment quote service

7.3.1. Getting a quote service connection

7.3.2. Extracting the price quote from the HTML

7.3.3. The MIDlet’s handling of quote data

7.4. Summary

Part III Developing for PDAs

8. J2ME on a PDA, a KJava Introduction

8.1. PDA profile alternatives

8.1.1. Java PDA development environments

8.1.2. What is KJava?

8.1.3. What is MIDP for Palm OS?

8.2. HiSmallWorld in KJava

8.2.1. Getting Started

8.2.2. What is a Spotlet?

8.2.3. Compiling HiSmallWorld

8.2.4. Preverifying KJava applications

8.2.5. Creating the Palm OS application

8.2.6. Running the application

8.3. Deploying to the actual device

8.4. HiSmallWorld revisited using MIDP for Palm OS

8.4.1. MIDP application code

8.4.2. Converting the JAR file to PRC

8.4.3. Deploying the MIDP for Palm OS applications

8.5. Summary

9. KJava User Interface

9.1. KJava application control

9.2. The investment quote application control in KJava

9.3. KJava user interface

9.3.1. Drawing to the display with the graphics object

9.3.2. Components

9.3.3. Custom components

9.3.4. KJava collection classes

9.4. The investment quote application’s user interface in KJava

9.4.1. Creating and displaying components

9.4.2. Drawing with graphics

9.5. Handling user interactions in KJava

9.5.1. Spotlet event-processing methods

9.5.2. Handling beaming events

9.6. Handling the events of the investment quote application in KJava

9.6.1. Handling key entry events

9.6.2. Handling pen taps

9.6.3. Handling pen movement

9.7. Summary

10. KJava Data Storage

10.1. Palm OS databases

10.1.1. Different types of Palm OS databases

10.1.2. Palm OS record database

10.2. KJava database API

10.2.1. Opening and creating databases

10.2.2. Accessing the database

10.3. Implementing the investment quote persistent storage in KJava

10.3.1. The stock/mutual fund record

10.3.2. Storing investment quotes

10.3.3. Retrieving records

10.4. Revisiting the connection to the Internet

10.5. Accessing Palm OS application databases

10.6. Summary

Part IV Developing for the Enterprise: Beyond the Specifications

11. Real-World Design

11.1. Dealing with stakeholders

11.1.1. Get them familiar with the devices early

11.1.2. Set expectations

11.1.3. Gathering requirements

11.1.4. State of the organization

11.2. A development scenario

11.2.1. Analysis

11.2.2. Options

11.3. Guidelines for building J2ME applications

11.3.1. The user interface

11.3.2. The network

11.3.3. Data exchange formats

11.3.4. Data synchronization

11.3.5. Data storage

11.3.6. Memory

11.3.7. Portability between profiles

11.3.8. Security

11.3.9. Internationalization

11.4. Architectural tools and techniques

11.4.1. Questionnaire: assessing if mobile and wireless is a good fit

11.4.2. Mobile application models

11.4.3. Architect’s checklist

11.5. Summary

12. Integrating the Server

12.1. Examining server integration

12.1.1. Avoid monolithic applications

12.2. What technology to connect to?

12.3. Servlet example

12.4. XML

12.4.1. Using XML

12.4.2. Open standards of XML

12.4.3. Consequences of XML in J2ME

12.4.4. Small-footprint parsers

12.5. XML using JSPs example

12.5.1. How JavaServer Pages work

12.5.2. Creating the JSPHelper

12.5.3. Creating the JSP

12.5.4. Creating the J2ME Client

12.6. Summary

13. The Network ConnectionSource

13.1. About the Generic Connection Framework

13.1.1. Where the Generic Connection Framework lives

13.1.2. Working with the Connector class

13.1.3. The Connector is a factory

13.1.4. How the Connector finds the correct class

13.2. Using the Generic Connection Framework

13.3. HTTP-based connections

13.3.1. Establishing a connection

13.3.2. Using the connection

13.3.3. Compiling and running the application

13.4. Socket-based connections

13.4.1. Writing to sockets

13.4.2. Reading from sockets

13.4.3. When to use sockets

13.4.4. Client-server socket example

13.5. Datagram-based connections

13.5.1. Datagram example

13.6. Summary

14. J2ME Runtime Environment

14.1. The Java runtime environment

14.1.1. Lifecycle of the Java Virtual Machine

14.1.2. Java Virtual Machine responsibilities

14.2. The J2ME runtime environment

14.3. CLDC-compliant virtual machines (the KVM)

14.3.1. KVM lifecycle

14.3.2. Preverification

14.3.3. In-device verification

14.3.4. Security

14.3.5. Unsupported Java features

14.3.6. Multithreading

14.3.7. Garbage collection

14.3.8. Internationalization

14.3.9. Application management (JAM)

14.3.10. Java Code Compact (JCC)

14.3.11. Deployed classes

14.3.12. Debug support

14.4. CDC-compliant virtual machines (the CVM)

14.4.1. Garbage collection and the CVM

14.4.2. Memory references in the CVM

14.5. Summary

15. Related Technologies

15.1. J2ME implementations

15.1.1. esmertec’s Jbed

15.1.2. Motorola’s Embedded Reference Implementation (MERI)

15.2. The other Sun specifications

15.2.1. PersonalJava

15.2.2. EmbeddedJava

15.3. Non-J2ME alternatives

15.3.1. ChaiVM by Hewlett-Packard

15.3.2. IBM’s VisualAge Micro Edition

15.3.3. Waba by Wabasoft

15.4.1. Java Card

15.4.2. Java Native Interface

15.4.3. Jini

15.4.4. JavaPhone and Java TV APIs

15.5. Non-Java alternatives

15.5.1. WAP/WML

15.5.2. Other languages

15.6. Data storage and synchronization

15.6.1. Data storage

15.6.2. A data synchronization standard, SyncML

15.6.3. XML

15.7. J2ME supplementary technology

15.7.1. GUI, kAWT

15.7.2. Web browsing, Kbrowser

15.7.3. Encryption, Bouncy Castle

15.8. Summary

[[part_id_apps] = Appendixes

Appendix A: Development Tools

Appendix B: Resource Links

Appendix C: Java and J2ME History

C.1. Oak and the Green Project

C.2. Java and the Internet

C.3. Evolution of Java

C.3.1. Java 1.02

C.3.2. Java 1.1

C.3.3. Java 2

C.3.4. SDK 1.3

C.3.5. Java 3 coming soon?

C.3.6. Java today

C.4. Origins of J2ME

C.4.1. Micro-Java rebirth

C.4.2. Early access versions of J2ME

C.4.3. J2ME’s continuing evolution

C.4.4. J2ME today

Appendix D: J2ME Wireless Toolkit

D.1. Downloading the Wireless Toolkit

D.2. Installing the J2ME Wireless Toolkit

D.3. Hello World project revisited

D.3.1. Starting the toolkit

D.3.2. Creating a project

D.3.3. Editing the project settings

D.3.4. Entering the Java code

D.3.5. Building a project

D.3.6. Running a project

D.3.7. Palm OS Emulator

D.3.8. Operating from the command line

D.4. Summary


About the authors

James White is Wireless Practice Manager and Senior Consultant at Fourth Generation, a St. Paul, Minnesota based software application consulting firm.

David Hemphill is Lead Architect at Gearworks, Inc. a Minnesota-based company that provides mobile and wireless field service solutions.

placing your order...

Don't refresh or navigate away from the page.
eBook $23.39 $35.99 PDF only
Java 2 Micro Edition (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.

FREE domestic shipping on three or more pBooks