What are MIDP, CDC, etc.
Someone posted a question as to what MIDP, CDC, CLDC etc are. At the cost of getting very technical we need elaborate on the java architecture to explain exactly what the differences are.
Java Virtual Machines
Java programs are compiled into a machine independent pseudo-code, that is called bytecode. To run this bytecode you need a so called virtual machine. A virtual machine is a device specific program that takes your bytecode and translates it to instructions the hardware understands. This seperation makes Java portable between operating systems and machine types. Most software developers only encounter the garden variety of Java Virtual Machine (JVM); the type you run on a PC or server. But this is where it gets nastier for mobile developers.
The three musketeers
There are three varieties of JVM:
- Regular Java Virual Machine (JVM).Used by Java Enterprise Edition (J2EE), Standard Edition ( J2SE) and Connected Device Configuration (CDC). Allows you to access native code on the machine it is running and does cool stuff like verifying your java bytecode to make sure it doesn't do anything it shouldn't (like format your hard drive). The Connected Device Configuratio (CDC) is intended for high end PDA's/smartphones and contains a fair amount of the standard Java packages.
- Kilobyte Virtual Machine (KVM). Intended for small devices with crappy processors and a pathetic amount of memory. To get the virtual machine to run on these devices they decided to rip a lot of stuff out: Most notably lots of useful packages and classes and the bytecode verifier. So programmers have to run a seperate verifier to make applications for this virtual machine. Also they removed the capacity to run native code. Java configurations that run on the KVM are called Connected LIMITED Device Configurations (CLDC). If you want to start programming for CLDC beware; programmers are left with a bare minimum of classes - its java in 1998 all over again.
- Card Virtual Machine (Card VM)They ripped so much out of this virtual machine that it can run on a smart card (i.e. in the chip on your credit card or on your SIM card). I've never tried it, and hope i never have to. Supposedly you can do really cool stuff with RSA encryption.
In summary: CDC refers to java that runs on one type of virtual machine (JVM) and CLDC refers java that runs on another type of virtual machine (KVM)
In the embedded and mobile arena they (the organisations that lumbered us with Java Micro Edition - i always envision them as committees sitting around formica tables drinking coffee from plastic cups) decided to make life easier by introducing profiles. A profile is aimed at applications of a specific type. The main profiles are:
- Mobile Information Device Profile (MIDP). Translates as Java for cellphones. Manages the lifecycle of programs on the cellphone: installation, security, startup, running, pausing, stopping etc. The main entity in this profile is called a MIDlet. A MIDlet is the thing that you install, run etc. Security is writ big in this profile. Anything remotely interesting (like doing an http request to a server) will result in the cellphone asking the user to verify they want this to happen.
- Personal Profile (PP). Translates as Java for Windows Mobile / Palm devices. The main entity in this profile is called an Xlet. An Xlet is the thing that you run etc. Installation and security are not managed much in this profile. You can copy across your class files and run them using the Personal Profile virtual machine.