Sunday, December 28, 2008

J2ME Basics

J2ME: Micro Java



Beyond the desktop and enterprise, Java may be found on small devices ranging from smart cards to PDAs to television set-top boxes. These micro devices typically are categorized as either low-end or high-end devices. Low-end devices (such as mobile phones and entry-level PDAs) support less-powerful microprocessors and less memory than their high-end counterparts (for example, television set-top boxes and more capable PDAs). Furthermore, a low-end device's network connections tend to be intermittent and, unlike those of a high-end device, don't have a large network bandwidth. To support Java on all micro devices, Sun developed J2ME.

J2ME's collection of highly optimized Java 2 Platforms addresses the needs of micro devices. Most J2ME platforms support the configuration and profile concepts:

*

Configuration: Combination of virtual machine and a minimal set of class libraries, providing base functionality for a range of similar micro devices
*

Profile: Higher-level class libraries that further define application lifecycle, user interface, and device-specific properties access

There currently are two J2ME configurations: Connected Limited Device Configuration (CLDC) and Connected Device Configuration (CDC). CLDC, the smaller configuration, targets low-end devices with 16-bit or 32-bit microprocessors and 128–512 kilobytes of memory for a Java implementation and applications. CLDC supports two Sun virtual machines: the original Kilobyte Virtual Machine (KVM)—a term derived from CLDC's support of micro devices that have memory measured in kilobytes—and the newer (and higher-performance) CLDC HotSpot Implementation virtual machine, which supports 32-bit microprocessors with 512KB to 1MB of memory. In contrast, CDC targets high-end devices with 32-bit microprocessors and at least 2MB of memory for a Java implementation and applications. Unlike CLDC, CDC supports Sun's Consumer Virtual Machine (CVM) and a larger subset of the J2SE standard class library. Although many vendors license Sun's KVM, CLDC HotSpot Implementation, and CVM virtual machines, other vendors may substitute their own compatible virtual machines for CLDC/CDC configurations.

Although vendors can create their own profiles, Sun provides its own standardized profiles. Sun's standard profile for CLDC is the Mobile Information Device Profile (MIDP). The MIDP offers the core functionality (user interface, network connectivity, application management, and local data storage) required by mobile applications. In contrast, CDC's standard profiles are Foundation, Personal, and Personal Basis:

*

The Foundation profile provides a foundation (with network and no user interface support) for the other two profiles, which layer themselves on top.
*

The Personal profile provides devices with full GUI/Internet applet support, and includes the complete AWT.
*

As a subset of Personal, the Personal Basis profile provides limited user interface support, but supports specialized graphics toolkits.

J2ME has elicited much interest among Java developers. Probably the two areas of most interest are the creation of MIDLets (J2ME applications that run in a CLDC/MIDP environment) and J2ME's support for wireless application development.

No comments: