The J2ME architecture is a designed for small computing devices that has limited memory, ranging from 128 kb to 2 MB and limited computational capability. These devices have either 16-bit or 32-bit processors. The J2ME architecture consists of Configuration and Profile.
Understanding J2ME Configuration
A J2ME Configuration specifies a minimum java platform for small devices having similar memory constraints and processing capability. For example, a configuration can define a java platform for all handled devices, such as mobile phones and PDAs having similar hardware recourses in terms of memory and processor.
The configuration supported by J2ME for wireless mobile devices is called Connected Limited Configuration Devices (CLDC) and CDC (Connected Device Configuration).
Components of CLDC
CLDC is implemented most of the mobile platforms and it contains various components of the java platform. CLDC consists of below components
- CLDC library
- Kilobyte Virtual Machine (KVM)
- Java Programming language
1. CLDC Library
The CLDC library contains a minimum useful set of APIs that supports application development and profile definition. CLDC library provide upward compatibility of application to other java platform editions, such as J2SE and J2EE. Upward compatibility is difficult to achieve because of inter-dependencies between the J2SE and J2EE library. To support upward compatibility of its libraries, CLDC segregates its library into two categories that represent the dependent and interdependent library.
The two categories of CLDC libraries are:
- Class that are interdependent on standard J2SE libraries, such as
java.lang.*
,java.util .*
, andjava.io.*
: These classes are upward compatible with J2SE and J2EE. - Classes that are independent of other java libraries but are specific to J2ME, such as javax.microedition.io.*:
2. Kilobyte Virtual machine (KVM)
KVM represents the virtual machine for small devices that implemented CLDC. The KVM is also compliant with JVM, which is used in J2SE edition but has limited features as compared to JVM.
Kilobyte Virtual machine
- Does not support JNI
- Does not support thread groups. Thread operations, such as starting and stopping a thread, can only be applied to individual object
- Does not support reflection features.
- Performs class file verification in two steps, preverifiction and in-device verification.
Java Virtual machine
- Supports JNI Includes features to reduce the cost of implementation of virtual machine
- Support thread group
- Support reflection features.
- Perform class verification only once, during compilation of java classes.
3. Java Programming Language
The java language used in CLDC does not support most of java language features available in the J2SE edition. Below lists the difference between the java language functionality in CLDC and J2SE.
CLDC Features
- Does not support
finalize()
method - Support only two error handling classes,
Java.lang.VirtualMachineError
andJava.lang.OutOfMemoryError
.
Java J2SE Features
- Support the
finalize()
method - Support other error handling classes, such as
java.lang.Error
andjava.lang.Exception
.
Version of CLDC
There are two versions of CLDC, CLDC 1.0 and CLDC 1.1. The CLDC1.0 was upgraded to CLDC1.1 by adding more features and specification to it. Below table compares the features of CLDC1.0 and CLDC1.1.
CLDC 1.0 Features
- Floating point operations are not supported
- Does not resolve all error-handling requirements
- Does not support thread objects
- Does not support all features of CLDC libraries
- Requires minimum 160 KB
CLDC 1.1 Features
- Support all floating point operations including all floating point byte codes, Float and Double class and all floating point values.
- Resolve all error-handling requirements, and includes an additional error-handling class, NoClassDefFoundError.
- Introduce a new method,
Thread.getName()
, Which helps identify the name of thread. Name of thread object in CLDC 1.1 are similar to the name of thread object in J2SE. - Requires minimum 192 KB and to support the floating-point operations higher memory is required.
