22-11-2012, 12:42 PM
JAVA FOR MOBILE APPLICATIONS
JAVA FOR MOBILE APPLICATIONS.doc (Size: 224 KB / Downloads: 34)
Although Java originally had been designed as a language for simple electronic applications, it nowadays is primarily used in heavy (often clustered) server environments. In cases where enough memory and considerable processor power is available, this uncomplicated language delivers practical results in a flexible way. Something which does not seem to agree with the limitations of most mobile devices. But more and more PDA’s and mobile phones offer a Java runtime environment, and indeed running usable software. How does Java function for mobile applications, and when do you choose Java over alternatives like xHTML?
In harmony with Java
There are two reasons why mobile devices get along well with Java. Firstly, the language architecture can easily be adapted. You do not have to use the many layers, design patterns and EJB’s which are typical of a heavy Java architecture. Instead of an excess of layers and accompanying interfaces the programmer simply uses POJO’s (Plain Old Java Objects) to write a ‘lean and mean’ program that works well with memory restrictions. With POJO’s the applications regain their nice small size, and are much faster as well. The second aspect enabling mobile Java is the existence of a specific runtime environment. A dedicated Java ME environment is available to develop mobile applications, alongside the standard SE development environment (for desktop support) and Java EE for server applications. Although Java SE is always used in the development environment, even if you program exclusively for server or mobile use, the runtime environment of ME is complementary and makes it possible to run the developed applications on modest
Java ME
Most Java development environments currently support Java ME and offer an emulator to test the results. Java ME can be downloaded for free from Sun, providing API’s, documentation and a simple toolkit to set up projects. The most important library, javax.microedition, enables control of the user interface on various small devices (see also image). Working with Java ME is relatively simple, and it can be used to develop excellent applications. The supplied emulator tests the designs easily. On top of that, Sun offers several sample applications including the source code.
Java of xHTML
Anyone with some understanding of Java will agree: there are plenty of possibilities for mobile Java applications. The question remains when to choose Java, en when to choose a different approach. That is an easy one, I think. If the existing applications are structured according to a classic three-layer model (database, server, client), and the mobile phone can function as a client, then xHTML will often be the preferred choice, mainly because of the speed of development and use. If GPRS, UMTS or other connectivity options are limited, and if it is desirable that the device performs optimally, also regarding graphics, then I would certainly choose Java.
What is a Mobile Application?
Most mobile applications use the Java Micro Edition (Java ME) platform, which was developed for small devices like mobile phones, but is now used on a wide variety of devices. Java ME uses scaled down subsets of Java SE components, virtual machines and APIs. It also defines APIs that are specifically targeted at consumer mobile and embedded devices. NetBeans with Java ME supports two base configurations of the Java ME platform and two additional mobile and embedded platforms:
• Connected Limited Device Configuration (CLDC) is for devices with less memory and processing power than CDC-based devices. The Mobile Information Device Profile (MIDP) is based on CLDC and billions MIDP devices are in use worldwide.
• Connected Device Configuration (CDC) is for devices with much greater memory, processing power and network connectivity such as smart phones, set-top boxes, and embedded servers and devices.
• Java Card platform is now supported in NetBeans and enables application development for smart cards and other microdevices.