Welcome!

Java Authors: Hari Gottipati, Tad Anderson, Yakov Fain, Pat Romanski, Colin Walker

Related Topics: Java

Java: Article

Java Inside

Java Inside

I recently upgraded my home network to use 802.11g. The prices for routers and PC cards have fallen throughout the year, but unfortunately the support has only marginally improved in that time and, after many re-installs, my network wasn't working. I eventually had to resort to probing the card to find out the exact chipset to get my Linux box up and running. It's fine now, but I found it ironic that probably the most important part of the card that would ensure compatibility was completely hidden, both on the box and in all of the documentation.

Things are a little different in embedded Java land. As a core Java developer you've probably heard of J2ME and technologies like MIDP and you could claim that the Java runtime inside a J2EE application server is at least hidden, if not embedded. Unlike my network card, with phones and other devices it's very clear whether they use Java technology and there's a very good reason for that.

I don't get to spend that much time with J2ME so I thought it would be useful to share a quick primer on J2ME technologies this month as a refresher. J2ME is a specification driven through the Java Community Process, just as J2EE and J2SE are specifications for the desktop and server platforms. As you would expect, devices typically have a set of constraints. Some have become more flexible over the last few years with improvements to CPU speed and also to the amount of memory available; others such as scheduling and process priorities have remained core fundamentals. The most discussed technologies that you may run into are CLDC, CDC, MIDP, and JTWI. The J2ME specification itself replaced Personal Java, which was a one-size-fits-all edition for small devices.

CLDC, Connected Limited Device Configuration, is a specification for very small footprint systems. Connected means that it can use Java networking APIs; limited refers to the footprint or resources. The configuration includes only a very small set of classes and reduced JVM. The first reference implementation that Sun released to adhere to that specification was called KVM. Adaptive compiler hotspot JVMs are now available for CLDC. Most of the popular deployments of CLDC are combined with an additional set of libraries called MIDP. The Mobile Information Device Profile provides the user interface classes, network management, security framework, media and games APIs, and more. This combination of CLDC and MIDP is the technology used in most Java-enabled phones.

The CDC, Connected Device Configuration, follows the same naming conventions as CLDC, but is for devices that can accommodate a larger footprint. Still designed for machines with as little as 2MB memory, this is significantly larger than CLDC, which scales down to 128KB. Again, there is a hotspot JVM implementation and the larger footprint size means that more of the J2SE APIs are supported. CDC also requires the use of profiles to deliver functionality, and with the personal profile you can support basic applets.

I've only mentioned a few profiles and have not even begun to discuss the optional packages that are available. Due to the rapid growth of packages and to ensure a basic level of functionality that extends beyond CLDC/MIDP, the Java Technology for the Wireless Industry (JWTI) specification was created. This in many ways is like a platform specification but defines the core level of functionality for devices that are JTWI compliant.

At this point you may be thinking what can I do with those configurations? They look like they're for device makers, not regular developers. That is partly correct, but you need a CDC or CLDC reference configuration to be able to run your wireless or embedded applications, and implementations of CDC and CLDC are available for running outside of a device on a regular PC. If you are interested in writing J2ME programs, the Java Wireless Toolkit is the place to start. This environment contains the core APIs you need to make your own phone application and to take advantage of the media APIs, wireless messaging, and the latest Bluetooth technology.

Sometimes knowing what's inside does make a difference. I would recommend giving the wireless toolkit a try; perhaps you have the next killer phone app in your reach!

Finally I wanted to mention one of the new developments in J2SE. Both the J2SE 5.0 source and now weekly binaries and source from J2SE 6.0 are available from http://java.sun.com. The J2SE 6.0 development is still in its early stages so if you are expecting to see big changes there, you'll need to wait a little while.

More Stories By Calvin Austin

A section editor of JDJ since June 2004, Calvin Austin is an engineer at SpikeSource.com. He previously led the J2SE 5.0 release at Sun Microsystems and also led Sun's Java on Linux port.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.