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:
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.
Click below for Web Resources related to this title:
Supporting Web Site
Click below for Sample Chapter related to this title:
The Wireless Internet Revolution.
Why Java Technology for Wireless Devices?
A Bit of History.
J2ME Standardization Efforts.
Java 2 Platform.
Java 2 Platform, Micro Edition (J2ME).
Key Concepts of the J2ME Architecture.
Introduction to the K Virtual Machine (KVM).
General Notes on Consumer Devices and Embedded Systems.
Scope of the CLDC and MIDP Standardization Efforts.
CLDC Application Model.
Java Language Specification Compatibility.
Java Virtual Machine Specification Compatibility.
Background and Goals.
Classes Derived from J2SE60.
MIDP Expert Group.
Areas Covered by the MIDP Specification.
Limitations of the CLDC Application Model.
MIDlet Suites.@AHEADS = MIDP System Software.
Structure of the MIDP User Interface API.
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.
A Note on Concurrency.
Characteristics of Wireless Data Networks.
Network Interface Considerations.
The HttpConnection Interface.
Sample Code (NetClientMIDlet.java).
The Record Management System.
Manipulating Record Stores and Records.
Sample Code (RMSMIDlet.java).
Application Resource Files.
Exiting a MIDlet.
The PhotoAlbum Application.
The AddressBook Application.
The Sokoban Game Application.
Development Environments for J2ME.
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).
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.
This book intends to
The topics in this book are organized as follows:
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
- Abstract Windowing Toolkit, 101
- AddressBook example, 211
- Alert, 128, 317
- AlertType, 317
- anchor points, 117
- animation, 119
- API documentation
- descriptor, 95
- development environment, 19
- Java, 45
- management, 46, 98
- management software, 98
- MIDlet lifecycle, 106
- resource files, 184
- resource files, specific, 56
- ArithmeticException, 277
- ArrayIndexOutOfBounds, 277
- ArrayStoreException, 277
- AWT, 101
- Boolean, 278
- Byte, 278
- byte arrays
- ByteArrayInputStream, 291
- ByteArrayOutputStream, 291
- Calendar, 62, 299
- Canvas, 107, 318
- coordinate system, 109
- redrawing mechanism, 108
- scaling to, 113
- visibility, 112
- CDC, 15
- Character, 278
- character encoding, 64
- Choice interface, 319
- ChoiceGroup, 132, 320
- Class, 279
- Alert, 317