August 21, 2003

Pitfalls of J2ME development

Vague specs and hardware differences pose problems for programmers

J2ME does a splendid job of promoting application portability across a diverse set of embedded devices. But some J2ME specs are vague enough that each vendor’s J2ME implementation might handle key sections of code in different ways. What follows is a rogue’s gallery of maddening variations that can stymie application portability.

* The MIDP specification doesn’t guarantee that the Display class — the object that interfaces to the screen — will be available until the midlet’s startApp() method executes. As a result, some implementations will safely permit making an instance of Display in the midlet’s constructor, whereas others will throw an exception that terminates the midlet without warning.

* Many of today’s phones have 1MB or more of RAM, exceeding the 512KB specified by the CLDC. Still, some J2ME implementations place limits on the amount of memory a midlet can use. The maximum heap size (available RAM storage for a midlet) can also vary. This means that a midlet that loads and executes on one device might not work at all on another.

* Different vendors use different typefaces to display the strings in a midlet’s messages, menus, and buttons. As a result, a carefully designed business form with control widgets can look good on one phone, while appearing nearly unreadable on another handset.

* Developers write J2ME applications with Java tools on desktop PCs. Since the handset being coded for may exist only as a limited number of prototypes — if at all — developers also typically use a simulator running on the PC to test and debug their midlets. The simulator uses the PC’s own J2SE  to execute the Java program, and occasionally it will rely too much on the J2SE’s capabilities. The result will be a midlet that runs properly on the desktop but not on the target device.

Close

On Twitter now

Application development

Powered by Twitter

White Paper

D2D Virtual Tape Library Replication Primer

This whitepaper explains the terminology and concepts behind Data Replication technologies and establishes some sizing rules through worked examples. Learn the new paradigm in disaster tolerance—protect data anywhere.

Download now »

White Paper

An Alternative to Virtualization for Datacenter Cost Savings

Server virtualization is a popular option for dealing with mounting datacenter costs. Another equally promising approach is the use of an Application Delivery Controller. Citrix NetScaler provides a low-cost way for organizations to reduce their server count and accrue cost savings from a reduction in space, cooling, power and personnel.

Download now »

White Paper

Why Your Firewall, VPN, and IEEE 802.11i Aren't Enough to Protect Your Network

The emergence of WLANs has created a new breed of security threats to enterprise networks.

Included in HP ProCurve WLAN solutions is security technology that alleviates threats from WLANs through:
* Monitoring wireless activity inside and out of the enterprise
* Classifying WLAN transmissions into harmful and harmless
* Preventing transmissions that pose a security threat to the enterprise network
* Locating participating devices for physical remediation

Download now »

White Paper

Bringing the Edge to the Data Center

Effectively address data protection challenges, implementing solutions that help store and protect business–critical data while cutting costs and improving efficiency and reliability.

Download now »

Sign up to receive InfoWorld Resource Alerts

Subscribe to the Developer World Newsletter

Receive a weekly roundup about the art and science of software development.

©1994-2009 Infoworld, Inc.