Thursday, 27th Jul 2017

«

»

Apr 19 2007

Some thoughts on Java 2 Micro Edition

Recently, I’ve had my first crack at writing a J2ME application. That was quite a disappointment. Check out the whole post to see why…

First off, I must say that I still am in the initial part of the learning curve, so that is actually kind of a beforehand impression.

For hobby-related reasons, I had to develop a application that would run on portable devices such cellular phones and handhelds. One way to dodge the “babel” of dialects and proprietary implementations of native languages (i.e. C and C++) out there was to resort to the Java world, which is supposed to be more or less portable. Since my primary target were mobile phones, the MIDP/CLDC profile was just the only way to go. To make things more complicate, there was an additional requisite: bluetooth communications.

Well… perfect! Almost modern cell phones out there support Java applications and have a Bluetooth port, so one would think that applications with the above requirements would run practically on all devices….

Much to my chagrin, this is by no means true: supporting Bluetooth communications with Java (the so-called JSR-082) is totally a whole new ball game and the JSR-082-compliant devices are only a very scarce subset of all those supporting Java Midlets and having a Bluetooth port.

But there’s more to it. For reasons I won’t delve into here, I meant also to develop a multiplatform BT communications library: it had to run fine both on Java Standard Edition and Java Micro Edition without changing a single line of code. There I found out a few other quirks: from the syntax point of view, Java2 ME takes you back to the Stone Age. No collections, no generics whatsoever. Would it have been to difficult to provide J2ME with a better support for modern language features? I sincerely doubt it.

Well, as I told you before, I still have claw my way into the J2ME jungle, so I’m not in the position yet to write off a whole platform as a dud. Sure, some differences are inevitable, especially on the GUI and interaction side due to the smaller displays and the lack of pointing facilities on mobile devices.

But undoubtedly, many features could have been way better conceived and implemented.