J2ME isn’t a specific piece of software or specification. All it means is Java for small devices. Small devices range in size from pagers, mobile phones, and personal digital assistants (PDAs) all the way up to things like set-top boxes.
J2ME is divided into configurations, profiles, and optional APIs, which provide specific information about APIs and different families of devices. A configuration is designed for a specific kind of device based on memory constraints and processor power. It specifies a Java Virtual Machine (JVM) that can be easily ported to devices supporting the configuration. It also specifies a strict subset of the Java 2 Platform, Standard Edition (J2SE) APIs that will be used on the platform, as well as additional APIs that may be necessary. Device manufacturers are responsible for porting a specific configuration to their devices.
Profiles are more specific than configurations. A profile is based on a configuration and provides additional APIs, such as user interface, persistent storage, and whatever else is necessary to develop running applications for the device.
Optional APIs define specific additional functionality that may be included in a particular configuration (or profile). The whole caboodle—configuration, profile, and optional APIs— that is implemented on a device is called a stack. For example, a possible future device stack might be CLDC/MIDP + Mobile Media API. See the section “Platform Standardization” later in this chapter for information on JSR 185, which defines a standard J2ME stack.
J2ME configuration divided into 2 categories according to device specifications.First one is Connected Device Configuration called CDC which sits on top of the J2ME.These devices have to meet the requirements specified by JSR community process.CDC devices target especially high end PDA’s , navigation systems , settop boxes.Therse devices has ,at a minimum, 512KB of read-only memory (ROM), 256KB of random access memory (RAM), and some kind of network connection.And also CDC devices gives full JVM support.
Other type of configuration is Connected Limited Device Configuration which is called CLDC.This configuration category include devices like mobile phones,pagers,PDA’s…As you see these devices smaller than the devices listed on CDC.CDC devices have limited memory , limited processor power ,limited screen size,limited battery life because of these developing applications for these devices is a important process.The CLDC is designed for devices with 160KB to 512KB of total memory, including a minimum of 160KB of ROM and 32KB of RAM available for the Java platform.For note connected means here network connection that is not very fast and intermitted.These devices support specific implementation of JVM which is KVM.K means here as far as i know “it is a JVM whose size is measured in kilobytes rather than megabytes”.
Other important part of J2ME is profiles.I am not going to dive into other profiles just MIDP which is the important and known one in J2ME development.MIDP stands for Mobile Information Device Profile and have also JSR process and specifications.Here is the MIDP 2.0 specifications.
- A minimum of 256KB of ROM for the MIDP implementation (this is in addition to the requirements of the CLDC)
- A minimum of 128KB of RAM for the Java runtime heap
- A minimum of 8KB of nonvolatile writable memory for persistent data
- A screen of at least 96×54 pixels • Some capacity for input, either by keypad, keyboard, or touch screen
- Two-way network connection, possibly intermittent
Most of the latest devices support MIDP 2.0 specification but older ones user MIDP 1.0.
Structure of MIDP Application
MIDP application has a API which comes from both CLDC and also MIDP 2.0 .CLCD api comes from core api defined in Java SE and MIDP api comes with java micro edition packages.Here is a list of avaliable packages.
For CLDC
- java.lang
- java.lang.ref
- java.io
- java.util
- javax.microedition.io
For MIDP
- javax.microedition.lcdui
- javax.microedition.lcdui.game
- javax.microedition.media
- javax.microedition.media.control
- javax.microedition.midlet
- javax.microedition.pki
- javax.microedition.rms
Also device vendors supply their own API’s specific to their device.These are different API’s from MIDP and as i said specific to that device not platform independent and make developers to reach device specific features.MIDP applications sits on top of the device specific OS , and use only api provided by MIDP and CLDC.Device specific java application use API provided by device vendor.(Device Specific API’s).
Advantages of MIDP
Portability
The advantage of using Java over using other tools for small device application development is portability. You could write device applications with C or C++, but the result would be specific to a single platform. An application written using the MIDP APIs will be directly portable to any MIDP device.
Security
A second compelling reason for using Java for small device development is security. Java is well known for its ability to safely run downloaded code like applets. This is a perfect fit—it’s easy to imagine nifty applications dynamically downloading to your mobile phone.