Home > Store

Core J2ME Technology and MIDP

Register your product to gain access to bonus material or receive a coupon.

Core J2ME Technology and MIDP

Premium Website

  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2002
  • Edition: 1st
  • Premium Website
  • ISBN-10: 0-13-066911-3
  • ISBN-13: 978-0-13-066911-7

Complete developers' guide to J2ME and the Mobile Information Device Profile 1.0.3.

  • Complete coverage of MIDP 1.0.3 for wireless developers
  • Practical applications of advanced J2ME and MIDP
  • Includes bonus chapter on MIDP for the Palm OS 1.0

J2ME is designed for devices with limited memory, display, and processing power including cellular phones, PDAs, and pagers. Core J2ME Technology & MIDP covers everything you need to develop powerful applications for this rapidly expanding wireless market.

Part I starts with an overview of J2ME, configurations, and profiles, before explaining in detail the Connected Limited Device Configuration (CLDC) and the Mobile Information Device Profile (MIDP). Muchow then walks you through creating a complete development environment-from downloading J2ME to troubleshooting.

Part II details programming with MIDP, including exhaustive coverage of the MIDP programming interface, high-level and low-level user interface components, networking support, and persistent storage.

An authoritative resource for programmers developing wireless applications, Core J2ME Technology & MIDP features:

  • Over 50 well-designed and clearly commented sample programs
  • A concise guide to using and installing MIDP for the Palm OS 1.0
  • A convenient, quick reference to MIDP and CLDC API's
  • Additional online resources available at www.CoreJ2ME.com

Sample Content

Online Sample Chapter

The Basics of J2ME

Table of Contents



About the Author.


1. The Basics of J2ME.

Java Editions. Why J2ME? Configurations. Profiles. Java Virtual Machines. Big Picture View of the Architecture. Compatibility between Java Editions. Putting all the Pieces Together.

2. Connected, Limited Device.

Configuration (CLDC). Hardware Requirements. Software Requirements. Java Virtual Machine Specification. Handling Security. Class File Verification. J2SE Inherited Classes. CLDC Specific Classes. K Virtual Machine.

3. Mobile Information Device Profile (MIDP).

Hardware and Software Requirements. MID Profile Architecture. MIDlet Suite. Accessing JAR and JAD Attributes from a MIDlet.

4. Development Environment.

Download the Software. Install the Software. Command Line Development. Packaging a MIDlet. Running a MIDlet on an Emulator. Download MIDlet onto a Mobile Device. Project Management Using Java Packages. J2ME Wireless Toolkit. Installation. Create a New Project. Configure the Project Settings. Write the Code and Build the Project. Using Java Packages. Locating the JAR and jad files. Configuring the Emulator. Toolkit Summary.


5. Basics of MIDlets and the Display.

MIDlet. MIDletStateChangeException. Display. Displayable.

6. Event Handling.

The Big Picture. Command Objects. Item Objects. Command and CommandListener. Item and ItemStateListener.

7. High-level User Interface: Part I.

Screen. Form. Item. DateField. Gauge. StringItem. TextField. Choice and ChoiceGroup. Image and ImageItem.

8. High-level User Interface: Part II.

List. TextBox. Alert and AlertType. Ticker.

9. Low-level User Interface.

Canvas. Graphics.

10. Creating a Display Manager.

Animation MIDlet. Display Manager API. Animating a Series of Images. Source Code.

11. Record Management System (RMS).

Persistent Storage with the Record Store. Navigating with RecordEnumeration. Sorting with RecordComparator. Searching with RecordFilter. Notification of Changes with RecordListener. Exception Handling.

12. Todo List MIDlet: Part I.

Using the Todo List. Interface Design. Data Design. Application Logic. Source Code.

13. Scheduling Tasks.

Timer. TimerTask. Example: Timer Template. Example: Todo List MIDlet Part II—Delay Timer. Example: Animation with Timer/TimerTask.

14. Generic Connection Framework.

Connection Hierarchy. Http Connection.

15. MIDP for the Palm OS.

Device Requirements. Download. Installation. MIDlets. Configuring Preferences. Example: keyCodes and gameActions.


A. Over the Air User Initiated.

Provisioning Recommended Practice. General Information. Device Client. MIDlet Suite Upgrade. MIDlet Suite Removal. Server. WAP.




It is estimated that in Japan alone over 20 million Java 2 Micro Edition (J2ME) enabled mobile phones were manufactured in 2001. The opportunity for those interested in writing for the J2ME platform speaks for itself. With its support for a broad range of devices and portability across platforms, acceptance among manufacturers and service providers has been astounding.

The focus of this book is on application development using the Mobile Information Device Profile (MIDP) and Connected, Limited Device Configuration (CLDC). Together, these application programming interfaces (API's) form a complete J2ME development toolkit for wireless devices including: mobile phones, pagers and personal organizers.

Who Is This Book For

As a developer at heart, I have often sought a book that covered "all I need to know" to get started with a technology that was of interest. Instead I found myself putting together pieces and parts based on information from various websites, newsgroups, how-to articles, and the like. There was never one

definitive guide covering everything: where to find the software, how to install and configure my computer, and learning to write applications from the ground up. Most important of all, there always seemed to be gap between what information I could find and what appeared to be available as part of the specification describing the technology.

I hope this book is as close to one-stop shopping as you will find for learning and developing applications for J2ME and the Mobile Information Device Profile. It has what I feel are the essentials to get up and running, everything from downloading and installing the software to writing applications from simple to comprehensive. The entire programming interface is covered in a logical step-by-step manner, leaving no stone unturned. It also includes a quick reference guide for both MIDP and CLDC.

Although this book takes a step-by-step approach to teaching application development with MIDP, the assumption is made that the reader will have experience as a software developer. Further, as J2ME is a subset of Java 2 Standard Edition, a background in Java programming is essential to make the most of this book.

Focus of this Book

With many years of experience as a developer, and an extensive background in technical training, I've discovered that most people (myself included) learn best by example. With that in mind, this book provides an abundance of source code, with the intention of presenting solutions to real-world programming issues. With over 70 examples, you'll have an excellent base of code to build upon:

  • Creating a "clipboard" to share data among components
  • Using streams to read and write persistent storage
  • Searching and sorting records in persistent storage
  • Low-level event handling
  • Primitive drawing operations (arcs, rectangles, text, etc.)
  • Creating simple animations
  • Scheduling timers
  • Creating a client request and interpreting a server response using HTTP
  • How and when to use HTTP request methods GET and POST
  • Managing sessions with a Java Servlet through cookies and URL-rewriting
  • Using a thread to download network data in the background
  • Download and view files and images
  • Many additional examples . . .

This book is divided into three sections:

Part I: Introduction to J2ME, CLDC, and MIDP

We begin with an overview of Java 2 Micro Edition. This includes information about the architecture of J2ME and how configurations and profiles make it possible for this micro version of Java to support devices with an exceptionally wide range of capabilities. Also included are step-by-step instructions for installing the required software and configuring your computer to develop J2ME applications (MIDlets).

Part II: Programming with MIDP

Here you will find the bulk of information about programming with the MID Profile. Presented in a tutorial fashion, we cover each aspect of the application programming interface. For each topic there is a brief introduction, information about the API, followed by one or more examples to bring home the concepts presented. Following is a list of the main topics:

  • Basics of MIDlets and the Display
  • Event Handling
  • High-level User Interface
  • Low-level User Interface
  • Case Study: Building a Display Manager
  • Persistent Storage with the Record Management System
  • Case Study: Todo-List MIDlet
  • Scheduling Timers and Tasks
  • Network Communication with the Generic Connection Framework
  • MIDP for the Palm OS

The case studies tie together concepts presented throughout the book. The first builds a simple, yet very useful class to facilitate managing objects displayed on a mobile device. You'll learn why such a class is needed, how to design and create the class, and will see the class used within a MIDlet that demonstrates how to animate a series of images.

The second case-study builds a todo-list application. At nearly 900 lines of code this comprehensive example covers many aspects of MIDlet development from interface and data design to the internal application logic. This application also makes extensive use of the persistent storage mechanism provided in MIDP.

Part II: Appendices

There are three appendices:

*Over the Air User Initiated Provisioning Recommended Practice
This addendum to the MID Profile covers the recommended procedure for deploying MIDlets
*CLDC Quick Reference
Connected, Limited Device Configuration API divided into the following sections: java.io, java.lang, java.util, javax.microedition.io
*MIDP Quick Reference
Mobile Information Device Profile API
Mobile Information Device Emulators

Sun Microsystems provides two reference implementations of MIDP. These software packages are available for developers to use as a testing ground, and also provide device manufacturers with a model, or starting point, for creating an implementation of MIDP for a device(s).

The implementations available from Sun are:

*MIDP and CLDC as standalone packages
Applications are compiled and run from the command line
*J2ME Wireless Toolkit
Applications are compiled and run within a minimal development environment

The actual look and feel of MIDP components may vary across implementations and/or devices. This has to do with the fact MIDP does not spell out how components are to look, rather, it specifies the functionality they must provide.

For instance, the figure below shows the same application running on three different emulators. Although each looks different, the functionality remains consistent.

Throughout the book, all application screen-shots were created with one of the two Sun Microsystems reference implementations. If you download and install an implementation of MIDP from a device manufacturer, or a third-party source, examples may look different than shown in the book, however, the functionality should be equivalent.

CoreJ2ME.com Website

There is a companion website for this book: www.CoreJ2ME.com. Here you will find the latest source code for the examples in this book, important notes about changes to the MIDP and/or CLDC specification and how this effects the examples (if at all), how-to articles, links to the software, information about J2ME and MIDP training, and a developer resources section that includes links to tools, faqs, discussion areas, newsgroups and mailing lists, as well as other J2ME related websites.


Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership