Unit I - Chapter 3 - Why should I go for J2ME?


As discussed earlier J2ME stands for Java 2 Platform, Micro Edition. Thus J2ME is a member of the Java programming language. As a Java programmer we should know that the Java programming language is having 3 editions, namely:

  • Java 2 Platform, Micro Edition (J2ME)

This edition caters to micro devices like the Personal Digital Assistant (PDA), mobile phones and other micro devices.

  • Java 2 Platform, Standard Edition (J2SE)

This edition caters mainly to the personal computer market. It has been built keeping in mind the desktops and the laptops.

  • Java 2 Platform, Enterprise Edition (J2EE)

This edition caters to the server software. This is main building block for the n-tier applications.

Thus we know that the J2ME platform has been developed by experienced brains and hands. Not only Sun Microsystems but Nokia, SonyEricsson, Siemens, Motorola, LG, Samsung and a host of other device manufacturers are supporting this platform. Also this is one of the most comprehensive platforms available in the market today for the programming of mobile devices.


Positive Points

  • Huge demand

Today the demand for the java based mobile phones has surpassed every expectation. We have more than 250 million mobile phones running java. The market is expected to reach a billion devices with a few years. Thus the demand for applications like games, stock tickers, ERP extensions, shopping carts has grown tremendously. People have shown a good response to this new technological medium. Also most of the big telecom operators have also shown a lot of interest in J2ME. Sprint, Vodafone, Orange, Hutch, Airtel, Reliance, Tata Indicom all have shown a lot of interest in J2ME

  • Broad penetration

Another reason for choosing J2ME is that it has reached a very broad level of penetration. J2ME phones are today used in developing countries like India in a very large way. Even people earning $ 100 a month are having java enabled phones in India. As for the rich they have a lot of devices to choose from. Thus this medium now reaches a vast number of the phone using population of the world.

  • Cheap hardware

The prices of J2ME phones have dropped considerably over the last year. Now we can get a brand new J2ME enabled phone for as low as $ 75 one time. Recently a big mobile operator in India launched a scheme whereby a person would have to pay just $ 11 upfront for the J2ME enabled phones and rest of the amount was being charged in installments. A big global mobile phone manufacturer is even talking of developing $40 mobile phones. Thus even the masses can afford this technology. In fact the PC revolution was never able to reach the interiors of the villages in the past 20 years due to the high cost of PCs. Thus even the economics is on the side of the J2ME platform.

  •  Cheap development tools

A person can download the Sun’s J2ME Wireless Toolkit for free. Even Sun 1 Studio Micro Edition, and Integrated Development Environment offered by Sun can in some cases be downloaded from the net for free. Even some of the mobile device manufacturers offer there development kits for free. Thus you can experiment with this new technology for free.

  • Faster production of applications

Unlike the PC application which take years to build and test, the compactness of programming increases the speed of application development. Typically applications take less than 3 months to build from scratch.

Also the strength of teams required for programming is also not much. Teams could generally range from 1 person working alone to 18-20 people, which is very small when compared to the desktop standard where even hundreds or even thousands of programmers are working simultaneously on an application. 

It is due to this fact that some mobile game marketing companies are boasting of game catalogs running into thousands of games!

  • Ability to develop your career

Since currently the demand for the J2ME application developers far outstrips the supply you have an opportunity to develop your career. Also since generally J2ME involves development in small teams you will be able to rise faster in the corporate ladder by doing J2ME. Since this technology is at just its beginning you will get time to hone your skills in the different aspects of J2ME. Many large corporates are planning to venture into this field. Within a couple of years I think J2ME programming will be one of the biggest employment generators within the IT industry throughout the world.


The Week Points and how to solve them

We will now discuss some of the points which will pose a challenge to you as a mobile phone programmer. In all the discussions below we will discuss about weaknesses of J2ME as a programming medium for the mobile phones in general. Many of the weaknesses were there in the initial specifications of J2ME. These days many of the weak points of J2ME are not there any more. Thus this platform has grown tremendously in the last couple of years in terms of technology to reach a point where most of the weak points have been taken care of.

  • Low amount of memory

Memory is the biggest constraint in the mobile phone programming. CLDC, MIDP enabled devices normally support MIDlets under 64 kb, some even below that. Thus as a programmer the biggest task is to conserve space and reuse variables as much as possible. Also the garbage collector is not as efficient as its bigger cousins. Thus the thrust should be on variable reuse. In fact I will like to share with you that the SKJ Technologies has created a complete spreadsheet application in less than 32 kb!


These days the new phones are supporting bigger applications and even the mobile operators are starting to remove the 64 kb download limit for an application. In fact recently I downloaded a game from an operator that was having a size of 150 kb.

  •  No support for windows

MIDP does not support having multiple windows on the mobile phone screen. Its user interface (UI) is divided into 2 parts:

  • High level UI
  • Low level UI

The main difference between the high level UI and the low level UI is the fact that in the high level UI the programmer only gives the parameters. The basic look and feel of the UI components is derived by the device according to its native look and feel. Thus the user experiences the same UI that he experiences when he works with the native UI. Also in the long run the application is more portable and will run on more devices thus fulfilling the basic promise of Java, ‘Write Once Use Anywhere’.


The high level API consists of the following:

  • Form
  • Alert
  • List
  • TextBox

The low level UI on the other hand mainly consists of the ‘Canvas class’ which could be used to accurately portray what a developer wants, without any modification by the device to have the look and feel of the native API. It is used mostly for games and custom applications where the high level UI is not able to support the task.

Thus we do not find any support for multiple windows or there states. This although difficult for the first time Windows programmer to grasp is a blessing in disguise. The developers are able to concentrate more on the actual programming then the actual nuts and bolts of the user interface.

  •  No floating point support     

Floating point refers to the support for decimal bearing numbers and fractions. In the PC environment or for that matter in many other mobile platforms this constraint is not there. But this constraint is there in the CLDC 1.0. At first the programmers feel frustrated, but there are practical ways to get around with this problem and in fact many applications available today that use decimal numbers without the floating point support. This difference really brings out a major difference in the mobile programming from the PC. If PC programming has some set paths, the paths in this platform are few, but there are almost always paths to overcome these problems and find the shortcuts.

I would like to tell you that at SKJ Technologies a class for doing floating point calculations has also been built. This class enables doing floating point calculations in CLDC 1.0. For licensing it you may contact info@skjworld.com . 

Also now some devices have started coming with CLDC 1.1 which offers the support for floating point. Thus in the future this constraint will cease to exist.

  •  No support for file system

Another major deficiency with this platform is lack of a file system. MIDP supports persistent storage but only through a simple Record Management System (RMS). The record management system consists of different records in a ‘RecordStore’ where they could each be individually read, retrieved and modified. The application can have many different RecordStores.

Through proper planning and execution this deficiency could also be overcome in a major way. In fact some real world applications support spreadsheets, game stage design stores, notes all with the help of the simple record stores.

This deficiency will cease in the coming years as the PDA Profile APIs will gain acceptance in the mobile phones. These APIs will allow the programmer to access the file system on a phone.

  •  No support for a printer

A major difference when writing applications on a PC and a mobile device and especially with CLDC, MIDP is that there is no support for the printers. The output of the applications could not be printed. Although a few phones do support printing with the help of Bluetooth but there is no direct support for printing through CLDC or MIDP with the help of a printing API package.

  •  Different features in different devices

One of the major differences from the PC environment is that a program written even in J2ME, although portable without any recompiling in different devices, will look and act differently in many ways. Some special APIs like the ‘Mobile Media API’ are only supported in some specific handsets. Also there is no one or two screen sizes supported by the different devices. The screen sizes can range from anywhere between 96 x 54 to more than 176 x 208. Thus portability takes a totally different dimension in these devices. Some features though standard in some devices are altogether missing in others. For example in Nokia 3650 and SonyEricsson T610 the alerts when displayed produce a sound while in Nokia 6610 this feature is altogether missing. Thus the developer should be open to the fact that what looks and feels great in one device could look awful on the other.

Although the above discussed points do bring out the challenges posed by J2ME platform but we can surmount them if we want. The only thing we will have to do to surmount all the challenges posed by J2ME is do some lateral thinking and that will eliminate all the problems.