March 2, 2021
Hot Topics:

The Connected Limited Device Configuration (CLDC)

  • By Eric Giguère
  • Send Email »
  • More Articles »

At the core of Java 2 Micro Edition (J2ME) are the configurations, the specifications that define the minimal feature set of a complete Java runtime environment. J2ME currently defines two configurations. In this article we look at the first of these, the Connected Limited Device Configuration, or CLDC for short.

The CLDC Specification

Like all J2ME technology, the CLDC is defined by a specification that has passed through the Java Community Process (JCP). At this time, there are two versions of the CLDC. Version 1.0, released in May of 2000, is known as Java Specification Request (JSR) 30. Version 1.1, currently in public review, is JSR 139. Because version 1.0 is the one that is currently shipping in devices, we'll concentrate on it.

The CLDC specification defines three things:

  1. The capabilities of the Java virtual machine (VM), which is not a full-featured Java VM.
  2. A very small subset of the J2SE 1.3 classes.
  3. A new set of APIs (application programming interfaces) for input/output called the Generic Connection Framework.

It's also important to understand what the CLDC does not define. The CLDC does not define any APIs related to user interfaces. The CLDC does not define how applications are loaded onto a device or how they are activated or deactivated. These and other things are defined by the J2ME profiles that use the CLDC as their base. So while it's true that the CLDC does define a complete Java runtime environment, the additional APIs defined by a profile or supplied by the vendor are really necessary to build useful applications.

The Virtual Machine

The Java VM used in the CLDC is restricted in certain important ways when compared to a full-featured J2SE VM. These restrictions allow the VM to fit the memory and power constraints of the small devices that the CLDC target: the CLDC VM and classes can fit in 128K of memory.

The primary restrictions on the VM are:

  • No floating point types.
  • No object finalization or weak references.
  • No JNI or reflection (hence no object serialization).
  • No thread groups or daemon threads (note that threads are supported, just not thread groups).
  • No application-defined class loaders.

Note that CLDC 1.1 relaxes some of these restrictions, in particular reenabling support for floating point types and weak references.

In addition to the above restrictions, the CLDC also requires class verification to be done differently. Class files are processed by an off-device class verifier, a process called preverification. At runtime, the VM uses information inserted into the class files by the preverifier to perform the final verification steps. Files that have not been processed by the preverifier are not loaded since they cannot be verified.

The J2SE Subset

The subset of J2SE 1.3 included in the CLDC consists of classes from these three packages:

  • java.lang
  • java.io
  • java.util

Only selected classes from each package are included: for example, the java.util.Vector and java.util.Hashtable classes are included, but none of the collection classes are. The largest package is the java.lang package, which defines the classes that are fundamental to any java application, classes like java.lang.Object or java.lang.Integer. The java.io subset only includes abstract and memory-based classes and interfaces like java.io.DataInput or java.io.ByteArrayInputStream. The java.util subset only includes a few utility classes.

Some of the classes are subsets of their J2SE equivalents. Configurations are allowed to remove unnecessary methods or fields, but they cannot add new public or protected methods or fields.

Page 1 of 2

This article was originally published on July 30, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date