Writing J2ME Application in Linux

April 30, 2008 at 2:23 am (Mobile, Programming, Uncategorized)

If you’re going to create a mobile game application better use j2me.. But if you’re mobile application runs in a background better used symbian c++.
Quick Start for setting up your workspace..
1. Install eclipse in synaptic manager for your IDE. Why choose eclipse? Simple and easy to use.
2. You need to have the Java Development Kit (JDK) and the Sun Java Wireless Toolkit (WTK) installed on your system. Click here for installation tutorial
3. Install JDK Sun Java Standard Edition (SE) Downloads .
4. After setting up all the installers, you can now create a simple Hello World.

Creating a project:
1 Choose File – > New -> Project
2. New Poject window will appear. Select J2ME Midlet suite then click Next. Type the name of your project. Example HelloWorld Select which Device your going to use. Then click Finish.
3. On the project explorer pane, right click the name of your project.Select New – > Package. Type the name of your package.
4. After creating a package, right click it, select New -> File . Type your filename for example “HelloWorld.java”

Type this source code.
Create the file src/HelloWorld.java with the following code:

// Sample adapted from http://developers.sun.com/mobility/midp/articles/wtoolkit/
package com.hello
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));
public void startApp()
{ Display.getDisplay(this).setCurrent(mMainForm); }
public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
public void commandAction(Command c, Displayable s)
{ notifyDestroyed(); }

5. You can now run your HelloWorld midlet.
6. Creating the jar file. Right click the name of your project . Select J2ME then Create Package..


  1. :D said,

    mam magrurun na po yon sa cell?

  2. carmiemendoza said,

    Yes.. There’s a folder build.. Send the jar and jad file. Jad file is the properties of jar file in your phone using bluetooth..

  3. Alvinator said,

    Wow lupet talaga! Explosive!

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: