Introduction to J2ME and MIDP
This section is an overview of many of the essential components that will let you create and run applications on J2ME, focusing specifically on the Mobile Information Device Profile (MIDP). Each of the components discussed in this section will be utilized in the tutorial. Here you will learn the basics of how each one is put together and interacts with the other technologies or components to aid in the development of mobile device applications on the Java platform.
Given the size and complexity of J2SE, there was a need to create a Java implementation targeted at devices with limited memory and/or processing power. J2ME is intended to fill this gap, providing a platform and development language familiar to millions of programmers.
Even among "micro" devices there are significant variations in capability. For example, a typical personal digital assistant (PDA) has a much larger screen, more memory, and a faster processor than a mobile phone. To support these differences, J2ME introduced the concept of configurations and profiles. Basically, a configuration outlines a set of device requirements (memory and connectivity, among others). A profile is the API that sits on top of a given configuration, providing the specific features and capabilities for a range of devices.
In this tutorial we will work with the Connected Limited Device Configuration (CLDC) and the MIDP. We'll begin by learning more about configurations and profiles, as well as the other foundational components of J2ME, in the next few panels.
A J2ME configuration defines a Java platform for a range of devices. Each configuration encompasses the features available in the Java language as well as the core libraries. A J2ME application can be built to meet the requirements of one of two device configurations: the Connected Device Configuration (CDC) or the Connected, Limited Device Configuration (CLDC). A device that implements the CDC has the following characteristics:
- 512 kilobytes (minimum) memory for running Java programs
- 256 kilobytes (minimum) for run time memory allocation
- Network connectivity, possibly persistent, and high-bandwidth
And here are the typical characteristics of a device that implements the CLDC:
- 128 KB of memory for running Java programs
- 32 KB of memory for run time memory allocation
- A limited user interface
- Runs on battery power
- Wireless network connection, low bandwidth
All of the example applications we develop for this tutorial will be for devices of the CLDC type.
A J2ME profile is an extension of a configuration. As noted earlier, it defines the libraries available to a developer writing applications for a specific device type.
The MIDP extends the CLDC. MIDP defines APIs for user interface components, input and event handling, persistent storage, and networking and timers -- all with consideration for the screen and memory limitations of mobile devices within the CLDC configuration.
We will use MIDP to develop all of the example applications used in this tutorial.
MIDP offers a high-level API and a low-level API for user interface development. We will focus on the
high-level API in this first half of the tutorial. MIDP's high-level interface is used to build common user-interface components such as
TextBox es, and
Gauge s, among others. The high-level API handles most component functionality for you, such as drawing each component on the screen.
The low-level API offers more flexibility than the high-level one, but is also more demanding to work with. The low-level interface and its components will be introduced in the second part of this tutorial.
A Java application that is built on top of the CLDC and MIDP is known as a MIDlet. A MIDlet suite consists of one or more MIDlets packaged together as a JAR. The MIDlets we develop together in this tutorial will help you to learn about the various high-level components of J2ME and MIDP.
The application manager is the software on a mobile device that is responsible for installing, running, and removing MIDlets. We'll run each of the applications we develop together in this tutorial, giving you the opportunity to learn firsthand how the application manager works.
In this section you learned about the components that will let you create and run applications on the J2ME platform. J2ME is a subset of the Java platform designed specifically for the development of mobile device applications. Applications built on the J2ME platform are developed for a particular device configuration and device profile. In this tutorial we will work with example programs developed for the CLDC and its extension, MIDP.