Mobile App Development with J2ME & EclipseME Plugin

To develop mobile app, you basically need the J2ME enabled IDE. I preffer Eclipse IDE which is even better then NetBeans IDE.

EclipseME is an Eclipse plugin that can be used to simplify the development of J2ME MIDlets using eclipse.

You need to install EclipseME plugin in your Eclipse IDE :

Open the Eclipse IDE and go to Help –> Install New Software, Enter the following URL in the ‘Work with’ text box

http://eclipseme.org/updates & click ‘Add’ button.

This will prompt an window to add repository & give some name like ‘EclipseME Updates’ & then press ‘ok’.

Download the Wireless Toolkit(WTK) from

http://www.oracle.com/technetwork/java/download-135801.html

To install the WTK,

chmod +x sun_java_wireless_toolkit-2.5.2_01-linuxi486.bin.sh

./sun_java_wireless_toolkit-2.5.2_01-linuxi486.bin.sh

Choose the JDK Path like /usr/java/bin & Installation Path like /opt/apps/WTK

Then run the ktoolbar (/opt/apps/WTK/bin/ktoolbar)

Open the eclipse & click new project –> J2ME MIDlet Suite

Go to Preferences –> J2ME –> Device Management

Import the devices from the Installation Path & Apply the changes.

In Project Explorer & click the src package from HelloWorld Project & right click it to add a java class.

Add the following code into it.

import javax.microedition.lcdui.*;

import javax.microedition.midlet.*;

public class HelloWorld extends MIDlet

implements CommandListener {

private Form mMainForm;

public HelloWorld() {

mMainForm = new Form("HelloWorld");

mMainForm.append(new StringItem(null, "Hello, World!"));

mMainForm.addCommand(new Command("Exit", Command.EXIT, 0));

mMainForm.setCommandListener(this);

}

public void startApp() {

Display.getDisplay(this).setCurrent(mMainForm);

}

public void pauseApp() {}

public void destroyApp(boolean unconditional) {}

public void commandAction(Command c, Displayable s) {

notifyDestroyed();

}

}

Then go to run configuration & select the J2ME & add the configuration you want and run it.

You can this via the Wireless toolkit,

The output is displayed in the Device Emulator.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s