Welcome Guest!
Create Account | Login
Locator+ Code:

Search:
FTPOnline Channels Conferences Resources Hot Topics Partner Sites Magazines About FTP RSS 2.0 Feed

FTPOnline Special Report: Mobile Java Development

email article
printer friendly
more resources

Get Creative on the Java ME Platform
Java ME continues to mature. Assess the platform, the standard APIs, the CLDC/MIDP stack, and device support for your needs.
by Michael Yuan

April 17, 2006

When Sun Microsystems introduced Java 2 Platform, Micro Edition (J2ME, which was renamed recently to Java ME) to the world in 2000, the promise was to bring Java's "write once, run anywhere" capability to the highly fragmented handheld-device market. Java ME is supposed to be the "one platform that rules all mobile phone manufacturers and carriers." It allows developers to focus their energy on creative work instead of tedious application porting across multiple devices, and it aims to create a mobile application marketplace where all applications compete on a level playing field.

ADVERTISEMENT

After six years, Java ME has met with great success. It is now supported by all major mobile phone vendors and carriers. Today, more than one billion devices support Java ME out of the box. However, has Java ME fulfilled its "write once, run anywhere" promise?

Let's examine the current state of Java ME and the entire mobile application market. The aim here is to help you decide whether Java ME will fit your next project, and if it does, to focus on how to develop portable Java ME applications. Primarily we'll concentrate on mobile phone development on the Java ME platform, that is, the Common Limited Device Configuration (CLDC)/Mobile Information Device Profile (MIDP) stack including smartphones and PDA phones. Java ME has another stack, known as the Connected Device Profile (CDC) and Personal Profile (PP), to support larger personal digital assistants (PDAs) and set-top box devices. The CDC/PP stack has not been widely adopted and is not within the scope of this discussion.

The Java programming language is designed for cross-device portability. Java source code is compiled to a bytecode format that can be executed by the Java Virtual Machine (JVM). The JVM translates the bytecode to the native machine code for the target device at runtime (see the sidebar, "More on the JVM"). To run Java applications, a Java ME–compatible mobile phone must have the JVM preinstalled. Device manufacturers develop and preinstall JVMs for their devices, and, hence, insulate the application developer from the underlying device hardware and operation system, which are typically proprietary. In fact, many mobile phones on the market have completely closed operating systems, and Java ME is the only programming interface for those devices.

Crucial Interfaces
The Java language is only the basis of Java applications. Java ME is an application development platform built on top of the Java language. The most important components of the platform are the Java ME application programming interface (API) libraries. The APIs determine what kind of applications you can develop with Java ME. To enable the cross-device portability of applications, it is crucial to standardize those APIs.

In Java ME all standard APIs are developed from the ground up as an industry consensus through the Java Community Process (JCP). The JCP membership is open to all interested vendors and individuals. Almost all mobile phone manufacturers and carriers participate in the JCP. Every API is proposed by a JCP member as a Java specification request (JSR) and then developed by an expert group. The membership of the expert group is also open. At the time of this writing, there are 68 JSRs for the Java ME platform. Some of the most important JSRs are:

  • JSR 30 for version 1.0 and JSR 139 for version 1.1 – The CLDC specifies the core language APIs for Java ME. For instance, it defines classes such as String and List, and it also specifies how the bytecode should be loaded into the JVM.
  • JSR 37 for version 1.0, JSR 118 for version 2.0, and JSR 271 for version 3.0 – The MIDP specifies basic application-level APIs. It contains a UI widget library for small screens, a set of low-level APIs to draw directly on the screen and capture user input, a network API to send and receive data over the HTTP protocol, and a persistence API to store application data on the device memory. The MIDP also specifies the application lifecycle (that is, the MIDlet model for starting, pausing, and exiting the application); security model (that is, how to determine whether an application is trusted to access the network, and so on); and how the application should be deployed over the wireless network.
  • JSR 120 for version 1.0 and JSR 205 for version 2.0 – The Wireless Messaging API (WMA) provides access to the device's Short Message Service (SMS) messaging functionalities. Using the WMA, the application can send SMS messages to any other device with a phone number. It can also receive incoming SMS messages. However, the WMA doesn't have access to the phone's native SMS inbox, and therefore cannot receive regular phone-to-phone SMS messages. It can only receive messages addressed to a special SMS port on the device. Most computer-based SMS tools and Internet-based SMS gateways allow you to send such messages with port numbers. In WMA version 2.0, you can also send and receive Multimedia Messaging Service (MMS) messages from the application.
  • JSR 135 for version 1.0 – The Mobile Media API (MMAPI) provides access to the device's audio and video peripherals. You can use the API to play back audio or video clips. On some devices, you can also use the API to record voice and capture picture/video from the on-device camera.



Back to top













Java Pro | Visual Studio Magazine | Windows Server System Magazine
.NET Magazine | Enterprise Architect | XML & Web Services Magazine
VSLive! | Thunder Lizard Events | Discussions | Newsletters | FTPOnline Home