Comparison Between J2me And Iphone Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Now a day's, there is a rapidly growth in Wireless technology. Moreover, these days almost every software application specialists is involved in developing mobile software. Currently J2ME, micro edition of JAVA 2 and Iphone technology are the most admired and acceptable mobile application development platform. In this paper, we firstly review the position of the two technologies J2ME and Iphone in the current market. Secondly we discuss the technology and platform which we used for developing the mobile application of the university to view the detail of the department.


Mobile applications offer you the chance to create rich, necessary applications for mobile phones. Java Platform, Micro Edition (Java ME) provides a strong, bendy environment for applications running on mobile devices and former embedded devices, mobile phones, personal digital assistants (PDAs), TV set-top boxes, and printers(Riggs, Taivalsaari, VandenBrink, 2001). Java ME includes flexible user interfaces, strong security, built-in network protocols, and support for networked and offline applications that can be downloaded dynamically. Applications based on Java ME are portable across many devices, yet control of each device's local capabilities.

Comparison between Two Technologies depend on Market

The iPhone is the most famous new generation mobile platform in today's marketplace Apple has provided software developers with an exclusive stage for creating different mobile applications and software's by releasing an SDK for the iPhone. This SDK has given developers full right of entry to the phone, including the multi-touch interface, accelerometer, closeness sensor, dialler, address book and calendar.

In reality, the process of developing iPhone software's and application is extremely much similar to design a Mac Operating System X application. IPhone is a mobile raised area, and it has supplementary explanation as conflicting to Mac OS X. Developers used a different approach while designing an iPhone application. Such features as the touch screen, restricted memory size and totally dissimilar pitch of utilize must always be engaged into suspicious consideration.

Developers are ready to provide customers with a large variety of best quality iPhone applications through:

IPhone SDK is used Professionally

Deep understanding of the interior architecture of IPhone platforms.

Broad information in Mac Operating System and mobile application as well as in software development

Easy to use

Convention application design is done by using the latest technology apparatus having 2D and 3d graphics

Superior usage of exclusive iPhone features like the multi-touch interface, accelerometer and closeness sensor.


The popularity of IPhone's as a whole is regularly increasing. The mobile marketplace is just beginning more quickly than that of the desktop marketplace, and this next generation device has already occupied up its constructive arrangement in the market. Steve Jobs, Apple CEO, announced at his presentation about the new invention of iPad device, that there were over 140,000 applications on the Apple Store by the end of 2009. From The report, we easily find that there are 23 countries in the Apple Mobile network with more than 100,000 exclusive iPhone and iPod touch devices. In 2009, the sale of Apple's handsets is increased to 150 percent worldwide and analysts believe that there will chances of more increase in Apple sales in 2010. They design IPhone applications of the following categories:

Online Shopping

Amusement and Sport


Exploration Tools

Social Networking


Business and Finance



On the other hand, J2ME or Java 2 Micro Edition is Sun's version of Java which is used for the software and applications development of minor machines such as Mobile phones, PDAs, customer electronics and other fixed devices with restricted hardware hold. However the most important amount of J2ME Application development is targeted at cell phones (Riggs, Taivalsaari, VandenBrink, 2001). The aggressive opposition among mobile phones, manufacturer has also led to a rush in J2ME application development. Moreover these phones are full with a lot of attractive superiority to give confidence to customers and outsmart competitors. These features are developed using J2ME. Examples of J2ME applications would range from games to maps and other such innovative features.

Many smart phones including Blackberry have J2ME developed applications. In fact, these applications have expanded the effectiveness of mobile phones. When these phones made their debut in the market, they were nothing more than a mobile talking device which also supports text messaging. But years after they were first introduced, these phones have graduated to a computing device. In fact a smart phone comes with features such as health check-up devices, web devices, business devices, multimedia, maps and navigation devices, weather devices and much more. Thanks to J2ME Programming all these applications are now available on your mobile phone(Ortiz, 2006).

Now let's see some of the advantages of J2ME applications. First of all they are so dominant and with the potential to access large data quantity. With Windows operating systems now installed on your phone to support J2ME applications, your phone can be suitable replacement for your PC or Laptop. Games applications can also keep you entertained at any time anywhere. J2ME Games are original and so rich that they have the potential to take on PC games or game consoles. With Internet technology available on your fingertips, keeping in touch or looking for information has never been so convenient. With J2ME applications on your phone, you can log on to social media websites or send emails to keep in touch with your friends, colleagues, and family members. The popularity of J2ME applications development is fast on the rise. Such application development is even outsourced to overseas companies.

Functionality Comparison between J2me and Iphone Application Development

Basic Concept (Iphone and j2me Development)

In order to build up iPhone (and iPod Touch) applications, the most important thing which we need is the iPhone SDK, which can be uploaded by developer in the system. For downloading SDK, developer requires membership which is free. If you want to analysis your applications on your device or share out your applications on the Apple Store, you need to create an account with an Apple at the rate of $99 year.

The iPhone SDK have a variety of applications that will allow you to implement your application as well as test and debug your applications. The most significant applications are:

Xcode: The IDE for the iPhone SDK

Interface Builder: To make user interface for iPhone application.

Instruments: Which offers a variety of tools to monitor application implementation

iPhone Simulator: This allows programmer to analysis his or her applications more rapidly than by deploying to a machine

The iPhone SDK will only run on Intel-based Mac running Mac Operating Systems X 10.5 (Leopard) or 10.6 (Snow Leopard).

On the other hand, a mobile application of Java (MIDlet) is compiled, obfuscated, preverifed and packaged. We need different things for implementing a mobile application using J2me:

The Java SDK and an IDE of our choice, e.g. Eclipse possibly with Mobile Tools for Java (MTJ), Net Beans with its mobility pack.

An Emulator, like the Wireless Toolkit, the Micro Emulator or a vendor specific emulator.

If we are developing mobile application professionally, we have to use a building tool like Maven and we also need abfuscator like ProGuard depend upon the setup which we used.

For developing mobile applications for various devices, the important task is to check out the J2ME polish, and the open source frame work.

Implementation of IPhone and J2me technology

Generally, Apple's high-level Cocoa Touch APIs is used during the development of mobile applications for the iPhone. This implies that we will write down the code of mobile application in Objective-C code language and it generates the user interface in Interface Builder having proprietary XIB file format.

As the name suggest Objective-C is a C-based object-oriented programming language. As a firm superset of C, it is fully well-matched with C, which means that we can use directly C source code in your Objective-C files.

If we are trying to use different object-oriented languages like C++ or Java, Objective-C's syntax might take some time to familiar with these languages. The concept of message passing through method calls and lack of namespaces support helps to differentiate Objective-c from other languages.

In the same way The J2ME environment is attractive and much easy, the beginning of J2ME application development is formed by the Connected Limited Device Configuration (CLDC) and the Mobile Internet Device Profile (MIDP), which are both quite easy to understand. Comparable to the high-quality old fashioned Applets we extend javax.microediton.midlet.MIDlet in our main class and then we are ready to go(Ortiz, 2004).

We can create the User Interface of our application in different ways:

High level LCDUI components: It use the mechanism found in the javax.microedition.lcdui package, e.g. Form or List.

Low level LCDUI: It uses javax.microedition.lcdui. Canvas for overprotective every pixel of our User interface.

SVG: Scalable vector graphics

J2ME Polish: Well-matched with the high level LCDUI frame work, separates the design in CSS, you can also use HTML for the user interface (

LWUIT: A Swing inspired User Interface framework (

Mewt: Use XML for defining the User Interface (

TWUIK: A powerful "Rich Media Engine" (

Testing between both IPhone and J2me Mobile Technology

As concert in the iPhone, Simulator may be better to actual devices by several orders of extent, it is absolutely essential to try-out on devices. If feasible, check your developing application on various diverse models, while adding up of the iPhone 3GS to the line up brought with it a faster CPU, GPU and more RAM and may thus perform in a different way rather than earlier iPhone generations.

It is easy to allocate and builds mobile software's and application to hundred testers through Ad-Hoc Provisioning, which you can set up in the Program Portal. Every iPhone (and iPod touch) has an exclusive Identifier (UDID - universal device identifier), which is a string of Fourty hex characters based on a variety of hardware parts of the device.

If you choose to test using Ad-Hoc-Provisioning, we have to follow Apple's detailed set-up instructions which are too easy to understand and implement. Every single step is very important for success, so make sure that you execute all the code correctly.

The iPhone SDK does not embrace support for component testing out of the box, but luckily Google added hold in Google Toolbox for Mac (GTM) with complete instructions available in their wiki. Also, iPhone developer Gabriel Handford has better on this work and released his project, GH Unit as open source. The test cases runs by GTM always used a shell script during the construct phase, whereas GH Unit runs the tests on the device like in the simulator and allowing the developer to connect a debugger to observe feasible bugs.

Testing your applications is absolutely very important. Test your device and application which you develop as early as possible and more frequently as you can on actual devices. Testing on emulators cannot reserve testing on genuine devices

It is impossible to measure up your appliance with 3GHz Dual CPU, 4 GB of RAM and broadband internet connection with typical mobile phones. Some emulators are moderately good (my personal favourites are BlackBerry and Symbian), but there are some effects you have to test in real:

UI: The occurrence of the user boundary can differ in actual sunlight when you're absent and concerning. It's a mobile device most users will be on the move.

Location: If you are using location information within your application, move both speedy and gradually.

Multimedia: Support for auditory, video playback and recording services can differ dramatically between devices and their relevant emulators.

Internet connectivity: Establishing internet connections can take an amazing amount of time. Connection hold-up and bandwidth are totally depending on the network, its current power and the number of simultaneous users.

Distribution of IPhone and J2me Mobile Applications

In order to reach the broadest feasible viewers, you should consider distribute your application on the Application Store. However there are other resources, such as the Cydia Store for lock up broken IPhones, but the prospective reach isn't virtually as huge as the App Store's.

We can develop a mobile application for the Application Store, but for that we need a 512x512 version of your application's icon, up to 5 display shots of your application as well as a build of your application that has been properly signed. Register in to iTunes Connect and upload your application according to the onscreen information.

After Apple has accepted your application, which generally shouldn't take more than 2 weeks, your application will be available to customers in the Application Store. The agreement process is the mainly complained component of the iPhone system.

Contrasting the iPhone, J2ME applications immediately set up on your phone, either by using Bluetooth or by using the air (OTA) using a web server(Giguere, 2000). Appreciation to the universal app stores, these days distribution is much easier than ever. They supervise the payment, hosting and advertisement and accept a profits share for that.

The main function of OVI is to targets users those using Nokia and distribute a seventy percent profits with the programmers (of gross sales, net of refunds and returns, less applicable taxes and, where applicable, fixed operator billing costs).

Java Store starts to sell Java based substance.

The Samsung Application Store supply software's and application for Samsung handsets.

Hand marks provide a carrier and retailer self-determining mobile store.

Get Jar is one of the oldest free mobile application distributors.

Part B: Description and Implementation for a Proposed Project.

Technology used for developing software of Department of University.

J2ME (Java 2 platform, Micro Edition) was announced by Sun Microsystems at the Java One Conference in June 1999. The purpose of J2ME is to enable Java systems to run on small computing devices. It does not define a new programming language but simply applies existing Java technology to handheld and embedded devices. Unlike J2SE or J2EE, J2ME is neither a piece of software, nor is it a single specification. Instead, J2ME is a platform, a collection of technologies and specifications that are designed for different parts of the small device market. It provides a robust, flexible environment for applications running on mobile and other embedded devices, mobile phones, personal digital assistants (PDAs), TV set-top boxes and printers.

J2ME Architecture

The J2ME programming suite for mobile phones consists of three main layers: Java VM, Connected Limited Device Configuration (CLDC), and Mobile Information Device Profile (MIDP). OEM specific java APIs provide additional functionality not available in the J2ME suite. Applications may be developed on top of any of these layers, but most MIDlets are typically built using the MIDP API.

Java VM: The mobile Java VM, also known as KVM (Kilobyte Virtual Memory), usually resides on top of the host OS. The KVM is about 40-80 KB in size and is specifically targeted toward devices with limited power and memory. The KVM runs on 16 or 32-bit RISC/CISC microprocessors with as little as 160 KB of total available memory. The Java Hotspot VM is also available which is designed for devices with 32-bit RISC microprocessors and 512KB to 1MB of available memory. The Java VM is very device specific and requires the most porting across platforms (Ortiz, 2004).

CLDC is the configuration layer of the J2ME architecture. It provides the core lower level functionality for memory and resource constrained devices. CLDC consists of four main packages:, java.lang, java.util,, which facilitates the bare minimum IO and utilities.

MIDP provides the core application functionality for mobile devices, which includes network connectivity, data storage, and user interfaces. The set of APIs in MIDP forms the basis of the programming interface for mobile phone applications development. MIDP and CLDC constitute the complete Java programming and runtime environment for mobile phones. Devices implementing MIDP and CLDC must adhere to some minimum requirements. The device screen must have at least a 96X54 pixel screen size, at least 128 KB of RAM, and 32 KB of heap space(Ortiz, 2006).

OEM Specific API: In addition to the CLDC and MIDP API, manufacturers offer additional APIs specific to their products. These APIs allow access to proprietary features and functionality available only on certain mobile phones. Such things may include access to the phone's audio, camera, vibrator, or lighting systems.

Mobile Information Device Profile (MIDP)

The Mobile Information Device Profile (MIDP) is an important component of the Java 2 Platform, Mobile Edition (J2ME). When combined with the Connected Limited Device Configuration (CLDC), MIDP provides a pattern for Java runtime environment for today's for the most part popular mobile information devices, such as cell phones and mainstream personal digital assistants (PDAs). The MIDP requirement was clear through the Java Community Process (JCP) by a specialist group of more than 50 companies, including leading device manufacturers, wireless carriers, and vendors of mobile software. It defines a platform for dynamically and steadily deploying optimized, graphical, networked applications (Ortiz, 2006).

 CLDC and MIDP provide the interior application functionality required by mobile applications, in the form of an identical Java runtime environment and a prosperous set of Java APIs. Programmers using MIDP can write software's and applications once, then install them quickly to an extensive range of mobile information devices. MIDP has been commonly adopted as the platform of selection for mobile applications. It is deployed globally on millions of phones and PDAs, and is supported by leading included development environments (IDEs). Companies around the world have already taken benefit of MIDP to write a broad variety of customer and venture mobile applications.


MIDP 2.0 (JSR 118) is an upgrade edition of the MIDP 1.0 specification. New quality contain an improved user interface, multimedia and game functionality, more widespread connectivity, over-the-air provisioning (OTA), and end-to-end protection. MIDP 2.0 is backward friendly with MIDP 1.0, and continues to target mobile information devices like mobile phones and PDAs.

MIDP 1.0 (JSR 37) is the unique design, which provides interior application functionality required by mobile phone applications, which includes necessary user interface and network precautions.

Reference Implementations

MIDP RI 2.0 is depending on the MIDP 2.0 specification and CLDC RI 1.0.4. The MIDP RI has been formed for device manufacturers who want to port this J2ME profile to another platform.

MIDP RI 1.0.3 is depending on the MIDP 1.0 specification and CLDC RI 1.0.3. Their target viewer is manufacturers who want to implement MIDP 1.0 on their devices.


Technology Compatibility Kit

The MIDP TCK can be licensed from Sun to certify a CLDC/MIDP operation on an exacting platform.

 Development Tools

The Sun Java Wireless Toolkit provides entire development support for developing MIDP applications, and works in combination with today's leading IDEs.

Sun ONE Studio, Mobile Edition is a Java-technology IDE for developing applications that can be deployed to Java technology-enabled mobile devices.


Rich User Interface Capabilities: MIDP applications offer the establishment for extremely graphical and sensitive applications. The graphical user interface is optimized for the small display size, varied input methods, and other local quality of modern mobile devices. MIDP provides perceptive routing and data entrance by taking full benefit of phone keypads, extra buttons such as arrow keys, touch screens, and small QWERTY keyboards. MIDP applications are installed and run locally, can operate in both networked and unconnected modes, and can store and handle constant local data strongly (Sing Li and Jonathan Knudsen, 2005).

Extensive Connectivity: MIDP enables developers to develop the local data network and messaging capabilities of mobile information devices. It supports most important connectivity standards, including HTTP, HTTPS, datagram's, sockets, server sockets, and serial port. MIDP also supports the Short Message Service and Cell Broadcast Service capabilities of GSM and CDMA networks, through the Wireless Messaging API (WMA) optional package.


Multimedia and Game Functionality: MIDP is ideal for construction convenient games and multimedia applications. A low-level user-interface API complements the high-level UI API, giving programmers greater control of graphics and input when they need it. A game API adds game-specific functionality, such as sprites and covered layers, which obtain benefit of devices, native graphics capabilities. Built-in audio provides maintain for tones, tone sequences, and WAV files. In addition, programmers can apply the Mobile Media API (MMAPI) voluntary package to insert video and other prosperous multimedia substance to MIDP applications.


Over-the-Air-Provisioning: A most important advantage of MIDP is its potential to arrange and modernize applications energetically and strongly, over the air.


End-to-End Security: MIDP provides a healthy protection model that complies with open principles and protects the network, applications, and mobile information devices. HTTPS support enables applications to apply existing principles such as SSL and WTLS to forward and accept encrypted data.

Building MIDP Applications

Midlets applications are called Midlets. MIDlets are developed and partially verified (Preverifying) on desktop computers and "cross compiled" to run on the "target" device. MIDlets are usually developed with the aid of an IDE which includes an MIDP device emulator. This allows the code to be tested before downloading to a real device. (Sing Li and Jonathan Knudsen, 2005).

Examples (from Sun): Net Beans 5.5 + mobility pack; J2ME Wireless Toolkit

MIDlets are downloaded to a real device through serial cable, infra red link, Bluetooth, or over the wireless network (Over the Air Provisioning).

J2ME Wireless Toolkit Emulator



Packaging the MIDP Applications

One or more MIDP Applications are deployed to a device as a MIDlet suite. A MIDlet suite consists of one or more MIDlets stored in a Jar archive and an application descriptor which is a text file with extension .jad.

The application descriptor describes the suite and sits outside the JAR archive and may, therefore, be downloaded first by the device and examined to check that the suite is required. Each Jar archive also has a manifest file META-INF\MANIFEST.MF that describes the contents of the archive and other information that the application will need during execution.

Hence application descriptor and the Jar MANIFEST hold some of the same information, but the application descriptor is easier to access. (Sing Li and Jonathan Knudsen, 2005).

Information includes:

Class names of MIDlets

Version of CLDC, MIDP expected

MIDlet Properties

These are predefined name value pairs that the MIDlet can access during runtime with the getAppProperty () methods.



MIDlet-Info-URL: http://localhost:8080/Posts/PostServlet

In theMIDlet

String URL = getAppProperty ("PostMIDlet-URL");

MIDlet Lifecycle

A MIDlet is an instance of the class: javax.microedition.midlet.MIDlet. The MIDlet is controlled by an Application Manager that is specific to each device. The Application Manager controls the installation and life cycle of the MIDlet. It does this by calling a set of lifecycle methods that the MIDlet implements. (Sing Li and Jonathan Knudsen, 2005).

The lifecycle is as follows:

Create instance - call the constructor.

MIDlet in the paused state.

Execute the instance - call startApp()

MIDlet in the active state.

While in the active state. The Midlet can call notify Paused ().

Puts MIDlet in the paused state.

While suspended the MIDlet can still receive timer events and other "call backs" i.e. methods

That the controller will call for specific conditions. As a consequence the MIDlet may need to become active again, in this case it calls resume Request () from within a call back method.

makes a request to the Application Controller to be placed in the active


While in the paused state. The Application Manager can call startApp ().

Puts MIDlet in the active state.

Destroy instance - call destroyApp ().

MIDlet Lifecycle

Figure 3: MIDlet Life-Cycle State Diagram


J2ME User Interfaces

The Display

Interface classes in javax.microedition.lcgui. Most display commands are defined at an abstract level. The devices lower lever hardware/software will control how each menu, combo box, etc. will actually be displayed.

MIDlet sees display through an instance of Display class which it gets from the static factory method get Display ().The display class presents an instance of Displayable to the device screen.

MIDlets change the contents of the display by calling set Current () with different types of Displayable. Displayable has a class hierarchy of different types of screen display. These represent standard GUI items like combo boxes.

Event Handling

A Command class acts like a J2SE Button that receives User commands.

Command c = new Command ("Exit", Command. EXIT, 0);

The first parameter names the Button. The second parameter identifies one of several common types of command which the underlying device hardware/software will know how to display.

Types include:

OK - Confirms a selection

CANCEL - Cancels pending changes

BACK - Moves to a previous Screen

SCREEN - Anything other than the standard types

The third parameter indicates priority on display, low priority commands will be delegated to secondary menus if there is no room on the primary display.

An instance of a Command is added to a Displayable using add Command ().


An instance of Command Listener is then defined to handle the invocation of the button. This class must implement the Command Listener interface, which basically means it must contain an implementation of the command Action () method. The Command Listener instance is then associated with a Displayable using setCommandListener ().(Sing Li and Jonathan Knudsen, 2005).


Tickers are strings of text that scrolls across the top of a Displayable.

To add a ticker, first create it and then add to a Displayable:

Displayable d = mForm;

Ticker ticker = new Ticker ("Project Submitted by Vikul, MSc Computer Science");

d.setTicker (ticker);

Connecting to Servers

HTTP is most common protocol used to access a wide variety of servers. The Generic Connection Framework (GCF) provides connection classes that support the HTTP (and HTTPS) protocols. (Sing Li and Jonathan Knudsen, 2005).

HTTP requests and responses have header and content information sections.

The GCF connection classes generally provide access these sections so that client and server can communicate through the standard POST and GET commands.

Generic Connection Framework

GCF is an API that supports a variety of network connections.

Contained in

A hierarchy of interfaces is defined with root interface Connection. Each interface lower in the hierarchy specialises the set of methods calls for each type of connection.



Socket Connection

Message Connection

These are interfaces, to build real objects static methods from the class are used. To open a connection call the open () method with a connection string specific to each type of connection. (Sing Li and Jonathan Knudsen, 2005).This method returns a connection instance which must then be cast to the appropriate type:

SMS Connection

String address = "sms: //" + "Phone Number "+ ":" + "Port Number";

Message Connection Conn = (Message Connection) Connector. Open (address);

HTTP Connection

String address = "http://localhost:8080/HitServletApp/HitServlet";

Http Connection Conn = (Http Connection) Connector. Open (address);

Making a connection with HTTP GET

Creating a connection instance sends a GET command to the server. Parameters may be set with the normal parameter encoding.

Reading URLs from properties

The MIDlet's manifest file holds name/value pairs that can be read at runtime. The URL name/value is accessed through the property name MIDlet-Info-URL.

Use: public getAppPropertry (String property Name)

Thread Control

As with all input/output, access to the network should be placed in a separate thread, so that slow network rates do not block other processing such as the user interface. (Sing Li and Jonathan Knudsen, 2005).


The implementation of the proposed project is shown in Appendix: 1


In this paper, I introduced comparison between the two technologies J2ME and IPhone mobile applications and also described the J2ME platform for developing the application for the department of computing course of the university using Midlet and Servlet. It aims at developers to take full benefit of J2ME in their mobile applications. J2ME supports persistent storage of data which is enough to save configuration data constantly for current and future mobile applications. J2ME consists of a variety of optional packages which provide special APIs. It is accepted that J2ME and its issue will offer the most everywhere result for prospect mobile applications with the permanent progress in mobile devices.