Wednesday, 2 January 2013

Starting With J2ME

For last few days I am working on J2ME.Java Platform, Micro Edition, or Java ME, is a java platform designed for embedded systems(mobile devices are one kind of such systems). Target devices range from industrial controls to mobile phones (especially feature phones) and set-top boxes. Java ME was formerly known as Java 2 Platform, Micro Edition (J2ME).
Just follow these Steps for developing a simple HelloWorld app in can also install it's jar file in your java phone.
Step 1-our basic requirement is an IDE(integrated Development Environment).i will use NETBEANS IDE 7.2.1 and JDK(java development kit) version 6 or 7.

Step 2-
  1. Start NetBeans IDE.
  2. In the IDE, choose File > New Project (Ctrl-Shift-N), as shown in the figure below.

NetBeans IDE with the File > New Project menu item selected.
Step 3-
choose java ME category and select MobileApplication and Click on next
New Project wizard: Choose Project
enter project name HelloWorld.Leave emulater platform as CLDC oracle java(TM) platform microedition  sdk 3.2 and click on finish.

Step 4-click on helloworld package and press CLDC and then MIDlet.Name of MIDlet should be Same as CLASS name.

Step 5-

 Each MIDlet must extend the abstract MIDlet class found in the
javax.microedition.midlet package, much like creating an applet
by extending the java.applet.Applet class. At the minimum, your
MIDlet must override three methods of this abstract class, startApp(),
pauseApp(), and destroyApp(boolean unconditional)
we will be using.
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;

Step 5-code in given sections.
* @author Shashank
public class HelloWorld extends MIDlet {
private Form form;
private Display display;
public HelloWorld(){
Step 7-

public void startApp() {
form = new Form("Hello World");
String msg = "Hello World!!!!!!!";
display = Display.getDisplay(this);
Step 8-
public void pauseApp() {

public void destroyApp(boolean unconditional) {
Step 9-Now run your Project(F6).

No comments:

Post a Comment