Understanding The Connected Device Configuration (CDC)
The second configuration at the core of Java 2 Micro Edition (J2ME) is the Connected Device Configuration, or CDC for short.The CDC is a superset of the Connected Limited Device Configuration (CLDC). It provides a much more conventional Java 2 runtime environment.
The CDC Specification
Like the CLDC (see my previous article, The Connected Limited Device Configuration (CLDC)), the CDC is defined by a specification that has passed through the Java Community Process (JCP). The CDC, known as Java Specification Request (JSR) 36, was released in March 2002.
The CDC specification is a much smaller document than the CLDC specification because the CDC is much closer to a Java 2 Standard Edition (J2SE) runtime environment than the CLDC. The CDC specification defines four things in particular:
- The capabilities of the Java virtual machine (VM). Unlike the CLDC, the CDC VM is a full-featured VM.
- A subset, much larger than the CLDC's, of the J2SE 1.3 classes.
- The same APIs (application programming interfaces) that are new to the CLDC -- in other words, the Generic Connection Framework (GCF).
- Support for file- and datagram-based input/output using both the GCF and the familiar java.io and java.net classes.
Note that, just like the CLDC, the CDC does not define any user interface classes or how applications are loaded and activated: these are left for the profiles to define.
The Virtual Machine
The CDC supports a complete, full-featured Java 2 virtual machine (VM) as defined in The Java Virtual Machine Specification. The low-level interfaces for calling native code, connecting to debuggers, and profiling code are optional, but if supported they must be the standard interfaces -- Java Native Interface (JNI), Java Virtual Machine Debugging Interface (JVMDI), and Java Virtual Machine Profiling Interface (JMVPI) -- used in Java 1.3.
Note that the CDC does not require preverification of classes, as full class verification is done on the device by the VM. Classes that have been preverified can also be used, of course, since the additional information added to the class files by the preverifier is ignored.
Because the VM is full-featured, and there are more classes, the minimum memory footprint for the CDC is larger than the CLDC's: the device needs at least 512K for the runtime environment, plus at least 256K to hold and run applications.
The J2SE Subset
The subset of J2SE 1.3 included in the CDC consists of classes from these packages:
As you can see, the CDC includes many more packages than the CLDC, and many more classes even in the shared packages. For example, the CDC includes the collections classes from the java.util package, while the CLDC does not. This makes the CDC a much more J2SE-like environment than the CLDC. There are still classes missing, of course. For example, the java.net package as defined by the CDC only includes the classes related to datagram sockets, not stream sockets.