Home > Store

Programming Wireless Devices with the Java 2 Platform, Micro Edition

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

Programming Wireless Devices with the Java 2 Platform, Micro Edition

Book

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

Description

  • Copyright 2001
  • Edition: 1st
  • Book
  • ISBN-10: 0-201-74627-1
  • ISBN-13: 978-0-201-74627-3

This book presents the Java™ 2 Platform, Micro Edition (J2ME™) standards that support the development of applications for consumer devices such as cell phones, two-way pagers, and wireless personal organizers. To create these standards, Sun collaborated with such consumer device companies as Motorola, Nokia, NTT DoCoMo, Palm Computing, Research In Motion, Siemens and many others. The result is a highly portable, small-footprint application development environment that brings the unique capabilities of Java technology, including platform independence and enhanced security, to the rapidly growing wireless market.

This definitive Java™ Series guide provides a programmer's introduction to the Java 2 Platform, Micro Edition. It presents a general description of wireless technology, an overview of the J2ME platform, and information on the small-footprint K Virtual Machine. In addition, the book details the Connected Limited Device Configuration (CLDC) and the Mobile Information Device Profile (MIDP), the standards which define the Java platform features and libraries for wireless, resource-constrained devices.

Key topics include:

  • Overview of the Java 2 Platform, Micro Edition (J2ME)
  • Goals, requirements, and scope of the CLDC and MIDP standardization efforts
  • High-level CLDC and MIDP platform architecture, including the security model
  • CLDC application model, and compatibility with the Java programming language and virtual machine specifications
  • Class libraries supported by the CLDC standard
  • MIDP application model
  • MIDP libraries, including user interface, networking, and persistence APIs

Numerous sample applications illustrate how to put the technology and standards to work, including a PhotoAlbum application, an AddressBook application, and a Sokoban game application.

Written by a team of authors that includes the original J2ME technology experts from Sun and Motorola, this book provides both a description of the Java 2 Platform, Micro Edition, as well as practical implementation advice.



0201746271B05102001

Downloads

Source Code

Click below for Source Code related to this title:
Source Code

Sample Content

Downloadable Sample Chapter

Click below for Sample Chapter related to this title:
riggsch2.pdf

Table of Contents



Figures.


Preface.


1. Introduction.

The Wireless Internet Revolution.

Why Java Technology for Wireless Devices?

A Bit of History.

J2ME Standardization Efforts.



2. Overview of Java 2 Platform, Micro Edition (J2ME).

Java 2 Platform.

Java 2 Platform, Micro Edition (J2ME).

Key Concepts of the J2ME Architecture.

Introduction to the K Virtual Machine (KVM).



3. Goals, Requirements and Scope.

High-Level Goals.

Target Devices.

General Notes on Consumer Devices and Embedded Systems.

Requirements.

Scope of the CLDC and MIDP Standardization Efforts.



4. High-Level Architecture and Security.

High-Level Architecture.

Security.



5. Connected Limited Device Configuration.

Introduction.

CLDC Application Model.

Java Language Specification Compatibility.

Java Virtual Machine Specification Compatibility.



6. CLDC Libraries.

Background and Goals.

Classes Derived from J2SE60.

CLDC-Specific Classes.



7. Mobile Information Device Profile.

MIDP Expert Group.

Areas Covered by the MIDP Specification.



8. MIDP Application Model.

Limitations of the CLDC Application Model.

MIDlets.

MIDlet Suites.@AHEADS = MIDP System Software.



9.IDP User Interface Libraries.

Structure of the MIDP User Interface API.

Abstract Commands.

Interactions with MIDlet Application Lifecycle.

Graphics and Canvas in the Low-Level API.

Low-level API for Events in Canvases.

Graphics Drawing Primitives.

Creating and Using Images.

Using Screens.

Using Items.

A Note on Concurrency.



10. MIDP Networking Libraries.

Characteristics of Wireless Data Networks.

Network Interface Considerations.

The HttpConnection Interface.

Sample Code (NetClientMIDlet.java).



11. MIDP Persistence Libraries.

The Record Management System.

Manipulating Record Stores and Records.

Sample Code (RMSMIDlet.java).



12. Additional MIDP APIs.

Timer Support.

System Properties.

Application Resource Files.

Exiting a MIDlet.



13. Sample Applications.

The PhotoAlbum Application.

The AddressBook Application.

The Sokoban Game Application.

Development Environments for J2ME.



14. Summary.


Appendix A. CLDC Application Programming Interface.

ALMANAC LEGEND.

java.lang.

java.io.

java.util.

javax.microedition.io.



Appendix B. MIDP Application Programming Interface.

java.lang.

java.util.

javax.microedition.io.

javax.microedition.lcdui.

javax.microedition.midlet.

javax.microedition.rms.



Index. 0201746271T04232001

Preface

In the past three and a half years, Sun has collaborated with major consumer device manufacturers and other companies to create a highly portable, secure, small-footprint Java application development environment for resource-constrained, wireless consumer devices such as cellular telephones, two-way pagers and personal organizers. This work started with the development of a new, small-footprint Java virtual machine called the K Virtual Machine (KVM). Two Java Community Process (JCP) standardization efforts, Connected, Limited Device Configuration (CLDC) and Mobile Information Device Profile (MIDP), were then carried out to standardize the Java libraries and the associated Java language and virtual machine features across a wide variety of consumer devices. Twenty four companies participated in these standardization efforts directly, and more than five hundred companies and individuals participated indirectly by sending feedback while the standardization efforts were in progress. Major consumer device companies such as Motorola, Nokia, NTT DoCoMo, Palm Computing, Research In Motion and Siemens played a key role in these efforts.

This book intends to make the results of the standardization work in the wireless Java technology area available to the wider software development community. At the high level, this book combines two Java Community Process Specifications, JSR-30 (CLDC 1.0) and JSR-37 (MIDP 1.0), and presents them as a single monograph. We have added a general introduction to the Java 2 Platform, Micro Edition (J2ME), provided more background material, and included a number of sample applications to illustrate the use of CLDC and MIDP in the real world. We also provide some guidelines and instructions for getting started with Java 2 Platform, Micro Edition.

A reference implementation of the software discussed in this book is available from Sun Microsystems under the Sun Community Source License (SCSL).

Intended Audience

This book is intended for software developers, content providers and other professionals who want to develop Java software for resource-constrained, connected devices. The book is also targeted to consumer device manufacturers who want to build small Java Powered devices and would like to integrate a compact Java application development platform in their products.

Objectives of This Book

This book intends to

  • provide an overview of Java 2 Platform, Micro Edition (J2ME),
  • provide a general introduction to the application development platforms defined by the J2ME standardization efforts,
  • explain the technical aspects of the J2ME Connected, Limited Device Configuration (CLDC),
  • explain the technical aspects of the J2ME Mobile Information Device Profile (MIDP),
  • provide sample programs to illustrate the use of CLDC and MIDP,
  • help you write your own J2ME applications.

How This Book Is Organized

The topics in this book are organized as follows:

  • Chapter 1, Introduction, provides a context for Java 2 Micro Edition and the CLDC and MIDP Specifications.
  • Chapter 2, Overview of Java 2 Platform, Micro Edition (J2ME), provides an overview of Java 2 Micro Edition, its configurations and profiles.
  • Chapter 3, Goals, Requirements and Scope, defines the high-level goals, requirements and scope of the CLDC and MIDP standardization efforts.
  • Chapter 4, High-Level Architecture and Security, presents the high-level architecture of the CLDC and MIDP standards, as well as discusses the security features of these standards.
  • Chapter 5, Connected Limited Device Configuration, introduces the CLDC standardization effort and summarizes the supported Java programming language and virtual machine features compared to the Java 2 Platform, Standard Edition.
  • Chapter 6, CLDC Libraries, introduces the Java class libraries defined by the CLDC Specification.
  • Chapter 7, Mobile Information Device Profile, introduces the MIDP standardization effort.
  • Chapter 8, MIDP Application Model, introduces the MIDlet application model defined by the MIDP Specification.
  • Chapter 9, MIDP User Interface Libraries, introduces the user interface libraries defined by the MIDP Specification.
  • Chapter 10, MIDP Networking Libraries, introduces the networking libraries defined by the MIDP Specification.
  • Chapter 11, MIDP Persistence Libraries, introduces the record management system (RMS) defined by the MIDP Specification.
  • Chapter 12, Additional MIDP APIs, introduces some additional MIDP application programming interfaces (APIs) such as Timers.
  • Chapter 13, Sample Applications, illustrates the use of CLDC and MIDP libraries through some sample applications.
  • Chapter 14, Summary, provides a summary of the topics discussed in the book, as well as outlines some future directions.

Related Literature and Helpful Web Pages

The Java Language Specification by James Gosling, Bill Joy, and Guy L. Steele. Addison-Wesley, 1996, ISBN 0-201-63451-1
The Java Language Specification, Second Edition by James Gosling, Bill Joy, Guy L. Steele, and Gilad Bracha. Addison-Wesley, 2000, ISBN 0-201-31008-2
The Java Virtual Machine Specification, Second Edition by Tim Lindholm and Frank Yellin. Addison-Wesley, 1999, ISBN 0-201-43294-3
Connected, Limited Device Configuration Specification,
http://java.sun.com/aboutJava/communityprocess/final/jsr030/
Mobile Information Device Profile Specification,
http://java.sun.com/aboutJava/communityprocess/final/jsr037/
Java 2 Micro Edition Product Web Page
http://java.sun.com/products/j2me/
K Virtual Machine (KVM) Product Web Page
http://java.sun.com/products/kvm/
Connected, Limited Device Configuration (CLDC) Product Web Page
http://java.sun.com/products/cldc/
Mobile Information Device Profile (MIDP) Product Web Page
http://java.sun.com/products/midp/
J2ME Wireless Toolkit Product Web Page
http://java.sun.com/products/j2mewtoolkit/

Acknowledgements

Like most books, this book represents the work of many people. In this case, however, an unusually large number of people around the world have worked to make the Java 2 Platform, Micro Edition--and hence this book--a reality. What started out as a two-person research project at Sun Labs grew rapidly into a highly collaborative product development and standardization effort involving hundreds of people in different companies. It is impossible to name all the people who participated and contributed to this work without inevitably forgetting many key names. The summary below is an attempt to give a high-level glimpse into the different groups of people who participated in this journey. To these and many others too numerous to mention, we give our thanks and appreciation for what they did to make these ideas and this book possible.

Many people read draft versions of this book, making comments that improved it substantially. The authors would like to thank David Baum, Bill Bush, Cristina Cifuentes, Greg Czajkowski, Steffen Grarup, Dean Hall, Laura Hill, Karen Hsiang, Tim Lindholm, Stuart Marks, Tasneem Sayeed, Howard Thamm, Ravi Viswanathan and Frank Yellin for their willingness to send comments and constructive criticism on the various versions of the book and the sample MIDlets. As usual, any remaining errors are the sole responsibility of the authors. Special thanks to Mark Patel for contributing the animation code in Chapter 9.

The authors would also like to thank Lisa Friendly for allowing us to publish this book in Sun's Java book series and for lending us capable technical writing resources to finish this book. Jim Holliday, our technical writer and editor at Sun Microsystems, edited various versions of this book tirelessly. Without his expertise in the mysteries of desktop publishing, grammar and that pesky topic known as punctuation, this work would have been much worse for the wear.

Numerous companies have been involved in the standardization efforts related to the Java 2 Platform, Micro Edition. The following companies participated in the CLDC and MIDP standardization efforts discussed in this book: America Online, Bull, DDI, Ericsson, Espial Group, Fujitsu, Hitachi, J-Phone, Matsushita, Mitsubishi, Motorola, NEC, Nokia, NTT DoCoMo, Oracle, Palm Computing, Research In Motion (RIM), Samsung, Sharp, Siemens, Sony, Sun Microsystems, Symbian and Telcordia Technologies. We would like to thank all the CLDC and MIDP expert group members and other individuals from the aforementioned companies for their active participation and contributions.

In addition to the companies listed above, hundreds of other companies and individuals sent us feedback while the CLDC and MIDP standardization efforts were in progress. The authors found it amazing how much of their time people were willing to contribute to ensure the progress of the Java technology in the wireless space.

From Sun, we would like to thank Bert Sutherland and Neil Wilhelm at Sun Labs for their initial support and encouragement to start the Spotless research project that led to the development of the K Virtual Machine (KVM) and the subsequent product development efforts. Bill Bush, Doug Simon and Bill Pittore played an essential role in the development of the Spotless system--the precursor of the KVM. Thanks to the continued efforts and support by Jon Kannegaard, Jim Mitchell, Bob Sproull, Mario Wolczko and many other people at Sun Labs, the active exchange of ideas and technology--and sometimes people--has continued even after the Spotless system had been successfully transferred into a product organization.

Like Bert Sutherland constantly used to remind people when he was the director of Sun Labs, technology transfer is a contact sport. Alan Brenner, Bill Bush, Mitch Butler, Mike Clary, Jim Mitchell, Moshe Gotesman, Frank Yellin and many others had a central role in ensuring the successful transfer of the Spotless technology to the Java Software product organization. Alan Brenner, who subsequently became the director of the Java Consumer Software organization, nurtured the initial product teams and visited numerous companies to gain support for the proposed standardization efforts in this area.

Various product groups in Sun's Java Software division participated in the design and implementation of the CLDC and MIDP reference implementations. The authors would like to thank the KVM team, MIDP team and Wireless Toolkit team members who worked on the reference implementations of the standards and products discussed in this book. The TCK (Technology Compatibility Kit) and Quality Assurance teams at Java Consumer Software also played a critical role in ensuring the quality and compatibility of the products. Special thanks go to Karen Hsiang for keeping all the teams coordinated, as well as to Alex Kuzmin for his relentless pursuit of quality and his willingness to go that extra mile (and spend those extra hours!) to make things happen on time.

From Motorola, we would like to thank Jim Van Peursem for co-representing Motorola in the MIDP expert group. Every project has its genesis, and the KVM project within Motorola had its start with the team of Bala Kumar, Matt Long, Jim Lynch, John Osman, Iris Plaxton, Paul Su and Ranjani Vaidyanathan--thanks guys for being there from the beginning and making CLDC and MIDP happen in Motorola.

Someone once said that hardware without software is a space heater. Similarly, without products, the CLDC and MIDP specifications are limited in their value. Thanks to Jyh-han Lin's Florida-based iDEN team for taking the earlier KVM efforts seriously, putting KVM in their product roadmaps, and shipping Motorola's first CLDC and MIDP compliant phone. In a similar vein, thanks to Michael Chu's Beijing-based "Tai Chi" team for their support. Finally, a big thanks to the Austin-based Wireless Software and Services (WSAS) team under Anne-Marie Larkin, in particular to Scott Osborne who managed the CLDC and MIDP engineering team, and to Jim Erwin who managed the CLDC and MIDP test team.

The preparation of this book has been a rather challenging endeavor itself. All the authors are located in different states and time zones, and because of the extensive amount of travel involved in standardization and product development work these days, a significant portion of the text in this book was written in airplanes, airports and hotels. Luckily, the advances in wireless technology have made it easier for people to stay in touch regardless of their physical location. Unfortunately, it also means that it is increasingly difficult to avoid those after 8 pm phone calls and urgent text messages and e-mails, especially from your co-authors and colleagues located in more Western time zones. The standards defined in this book, for better or worse, will probably only accelerate this trend.

And finally, but most importantly, Roger would like to thank Cathy, Kimberly, Brian and Catie for their support and forbearance during this exciting and intensive endeavor.

Antero would like to thank Leena, Eva Maria, Eetu and Ella for their love and support.

Mark would like to thank Joy, Zachary and Abby for their love, support, patience and understanding about those long trips and time away from home.

Roger Riggs, Burlington, Massachusetts
Antero Taivalsaari, Cupertino, California
Mark VandenBrink, Austin, Texas
April 2001


0201746271P04232001

Index

A
Abstract Windowing Toolkit, 101
AddressBook example, 211
Alert, 128, 317
AlertType, 317
anchor points, 117
animation, 119
API documentation
CLDC, 271
MIDP, 309
application
descriptor, 95
development environment, 19
example
AddressBook, 211
PhotoAlbum, 188
Sokoban Game, 237
Java, 45
management, 46, 98
operations, 99
installation, 99
launching, 99
removal, 99
retrieval, 99
version management, 99
management software, 98
MIDlet lifecycle, 106
model
CLDC, 44
limitations, 83
example, 188
MIDP, 83
resource files, 184
resource files, specific, 56
sample
See example.
arcs
drawing and filling, 115
ArithmeticException, 277
ArrayIndexOutOfBounds, 277
ArrayStoreException, 277
AWT, 101
B
Boolean, 278
Byte, 278
byte arrays
converting record data to and from, 161
ByteArrayInputStream, 291
ByteArrayOutputStream, 291
C
Calendar, 62, 299
Canvas, 107, 318
See also canvas.
canvas
coordinate system, 109
events
action, 112
key, 112
pointer, 113
redrawing mechanism, 108
scaling to, 113
visibility, 112
CDC, 15
Character, 278
character encoding, 64
Choice interface, 319
ChoiceGroup, 132, 320
Class, 279
class
Alert, 317

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020