Introduction Mobile Information Device Profile(MIDP)
Post date: Mar 3, 2011 4:52:23 AM
Mobile Information Device Emulators
Sun Microsystems provides two reference implementations of MIDP. These software packages are
available for developers to use as a testing ground, and also provide device manufacturers with a
model, or starting point, for creating an implementation of MIDP for a device(s).
The implementations available from Sun are:
• MIDP and CLDC as standalone packages
Applications are compiled and run from the command line
• J2ME Wireless Toolkit
Applications are compiled and run within a minimal development environment
Java Editions
Let's begin with a quick summary of the Java platforms currently available:
• Standard Edition (J2SE): Designed to run on desktop and workstations computers.
• Enterprise Edition (J2EE): With built-in support for Servlets, JSP, and XML, this edition is
aimed at server-based applications.
• Micro Edition (J2ME): Designed for devices with limited memory, display and processing
power.
Configurations
To support the broad range of products that fit within the scope of J2ME, Sun introduced the
Configuration.
A Configuration defines a Java platform for a broad range of devices. A Configuration is closely tied to a Java Virtual Machine (JVM). In fact, a Configuration defines the Java language features and the core Java libraries of the JVM for that particular Configuration.
Following are typical characteristics of devices within the two currently defined Configurations:
Connected Device Configuration (CDC)
512 kilobytes (minimum) memory for running Java
256 kilobytes (minimum) for runtime memory allocation
Network connectivity, possibly persistent and high bandwidth
Connected, Limited Device Configuration (CLDC)
128 kilobytes memory for running Java
32 kilobytes memory for runtime memory allocation
Restricted user interface
Low power, typically battery powered
Network connectivity, typically wireless, with low bandwidth and intermittent access
JVM and KVM
The engine behind any Java application (or applet, servlet, etc.) is the JVM.
Once you've compiled your Java source code into a class file(s), and optionally included them in a Java Archive (JAR) file, the JVM translates the class files (more accurately, the byte code in the class files) into machine code for the platform running the JVM.
The JVM is also responsible for providing security, allocating and freeing memory and managing threads of execution. It's what makes your Java programs go, so to speak.
KVM
For CLDC, Sun has developed what is referred to as a reference implementation of a virtual machine, known as the K Virtual Machine, or simply KVM.
The virtual machine itself requires only 40 and 80 kilobytes of memory
Only 20–40 kilobytes of dynamic memory (heap) are required
Can run on 16-bit processors clocked at only 25 MHz
The KVM is Sun's implementation of a JVM that fits the guidelines of the CLDC. It is not necessarily the only JVM that is or will be available.
Architecture
Generic Architecture
It begins with the host Operating System (OS) as the base, followed by the virtual machine (VM). The VM will take one of two forms:
For systems complying with the CDC, it will be the "traditional" virtual machine; that is, the same feature set as in the Java 2 Standard Edition.
For systems complying with the CLDC, it will be the KVM or a virtual machine that meets the specifications as required by the CLDC.
CLDC or CDC core libraries are next in the heirarchy. Profiles are the topmost layer, and are designed to provide a toolkit for writing applications for a particular device family.
MIDP Architecture
As before, the host OS is the base. The virtual machine will be the KVM. Remember, the KVM is Sun's implementation of a JVM meeting the CLDC specification—it may not be the only implementation available of a virtual machine for MIDP. CLDC core libraries are next, followed by MID Profile.
Will J2SE applications run on J2ME?
J2ME is basically a slimmed down version of J2SE. Many components have been removed to keep the platform small and efficient. An obvious example is that of the Abstract Window Toolkit—many mobile devices do not have the screen capabilities to provide advanced user interface components such as overlapping windows and drop-down menus.
On the other hand, if you write J2SE code that adheres only to the classes that are available within the J2ME Configuration you are targeting, then your programs will run on both platforms. Keep in mind, such applications will most likely be very constrained, with little to no user interface, as J2ME and J2SE offer completely different APIs for handling the display.
Will J2ME applications run on J2SE?
The same rules apply here. If you limit the code to what is common on both platforms, the answer is yes. However, the majority of software you write for a J2ME device will require special interface and event handling code. Thus, you are greatly limited to what types of programs will be appropriate for both platforms.
Putting all the Pieces Together
Sun created the Java 2 Micro Edition to allow development of Java applications for devices that do not have the same processing power and memory found on a typical desktop platform. Products may include cellular phones, PDAs, pagers, entertainment and automotive navigation systems, to name just a few.
J2ME is divided into two broad categories, known as Configurations.
CDC is a set of APIs to support "fixed" devices such as a television set-top box.
CLDC is a set of APIs targeted at devices that have limited processing power, display and memory. The majority of these devices will also be mobile (e.g., cellular phones and pagers).