Java has already conquered the server-side with J2EE, and it’s making inroads on the desktop. But the new Java 2 Platform, Micro Edition (J2ME) is aiming for something much smaller: pagers, set-top boxes, and mobile phones.
KVM: The Tiny Virtual Machine
The challenge with mobile devices is the lack of resources. We're talking about kilobytes of RAM and very slow CPUs. Sun has developed the "KVM" (Kilo Virtual Machine) to run on these devices. It’s a stripped-down JVM that lacks many features (like floating-point math or finalization) but fits in a tiny footprint.
Profiles and Configurations
J2ME introduces the concept of "Configurations" and "Profiles."
- CLDC (Connected Limited Device Configuration) is for the really small stuff.
- MIDP (Mobile Information Device Profile) adds the UI and networking APIs specifically for phones.
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class HelloMobile extends MIDlet {
public void startApp() {
Form f = new Form("Hello!");
f.append("Welcome to the mobile Java revolution.");
Display.getDisplay(this).setCurrent(f);
}
public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
}
The App Era?
Right now, your phone comes with whatever the manufacturer gave you. Maybe "Snake" if you're lucky. With J2ME, we can start imagining a world where users download new applications and games over-the-air (OTA).
The screen is small, and the input is just a numeric keypad, but the ability to run custom code on a device that people carry everywhere is a game-changer. I'm already thinking about how to build a mobile email client or a stock ticker. The "Write Once, Run Anywhere" dream is finally reaching our pockets.
Aunimeda develops websites and web applications for businesses - corporate sites, e-commerce, portals, and custom platforms.
Contact us to discuss your web project. See also: Web Development, E-commerce Development