CLDCConnected, Limited Device Configuration Cornelius Koo - 2005
CLDC Devices Characteristics• 160 - 512 kb total memory available for java platform• 16 bit / 32 bit processor• low power consumption, often battery powered• intermitten network connectivity (often wireless), limited bandwith
Hardware Requirements• CLDC doesnt have specific hardware requirements• Minimal memory requirements :• 128 kb - for running the JVM and CLDC libraries. This memory must preserve its content, even when the device is powered off. (Nonvolatile memory)• 32 kb - available during application runtime for allocation of objects. (Volatile memory / heap)
Software Requirements• The Operating System must be able to running JVM and managing Java applications on the device including : Select and launch application Remove application
Java Language for CLDC• CLDC doesn’t support floating point type. (double and float)• CLDC doesn’t support finalize() method.• CLDC only support limited set of Exception classes for error handling.
Java Virtual Machine for CLDC• JVM doesn’t support floating point operation.• JVM doesn’t support native interface and native method invocation.• Reflection is not available.• JVM must implement the classloader.• finalize() method is not available.• JVM doesn’t suport ThreadGroup class.• JVM doesn’t support weak references.
Weak References• Garbage collector recognizes that an object is being referenced, yet the object is still a candidate for garbage collection.
Security Handling• Any devices running Java application will need protection from malicious codes that may access system information or resources.• This “Low Level” protection is implemented through class file verification.
CLDC Class File Verification• Class file verification is done in 2 steps in CLDC.• 1st Step is pre-verification.• 2nd Step is in-device verification.
Pre-Verification• Pre-verification :• A software program is run to insert additional attributes into the class file.• Class file will be approximately 5% larger after pre-verification.• Done as part of development process or before a class file is loaded on a device.• A "Stack Maps" is added to the class file, describing what variables and operands are art of the interpreter stack space.
In-Device Verification• In-Device verification :• Once a device loads a pre-verified class file, the in-device verifier runs through each instruction.• There are several checks done to validate the code.• At any point the verifier can report and reject the class file.• Code verifier program for KVM is in the range of 10kb and less than 100 bytes of heap space required.
Internationalization• java.io.InputStreamReader• java.io.OutputStreamWriter• both can be used to convert from bytes to/from unicode.
Reference• Core J2ME Technology and MIDP. John W. Muchow. Prentice Hall PTR, 2002.• Enterprise J2ME: Developing Mobile Java Applications. Michael Juntao Yuan. Prentice Hall PTR, 2003.• J2ME in A Nutshell. Kim Topley. Oreilly, 2002.• Wireless J2ME Platform Programming. Vartan Piroumian. Prentice Hall, 2002.