- Java in your Computer. Download JDK from http://java.sun.com/javase/downloads/index.jsp
- Netbeans Mobility Pack or Latest Version Form http://www.netbeans.org/downloads/
Once You Installed the Application Mean Open Neatbeans
Step 1:
- Choose File > New Project (Ctrl-Shift-N). Under Categories, select Mobility. Under Projects, select MIDP Application and click Next.
- Enter Project Name field . Choose the Diretory you want to save the project.
- Check the Set as Main Project checkbox and remove the check from the Create Hello MIDlet checkbox. Click Next.
- Select the Sun Java Wireless Toolkit 2.52 for CLDC as the Emulator Platform and use the remaining defaults. Click Finish.
- Now you created a project .The project folder contains all of your sources and project metadata, such as the project Ant script.
- Right-click the defaultPackage node in the Explorer window and choose New > MIDlet
- Enter
HelloMIDlet
as the MIDlet name. Click Finish. TheHelloMIDlet.java
file is created and the source code is displayed in the IDE's Editor window. - Now add the code following code in the existing code.
/**
public class HelloWorld extends MIDlet implements CommandListener{
Form form;
Command exit;
StringItem text;
Display disp;
public void startApp() {
disp=Display.getDisplay(this);
initilize();
disp.setCurrent(form);}
public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
public void initilize(){
form=new Form("HELLO WORLD");
text=new StringItem("Hai How are u?","Bye",StringItem.PLAIN);
exit=new Command("Exit",Command.EXIT,1);
form.append(text);
form.addCommand(exit);
form.setCommandListener(this);}
public void commandAction(Command cc,Displayable dd)
{
if(cc==exit)
{
destroyApp(true);
notifyDestroyed();
} }}
Thats all ... Now you can run the Application
- Right Click the Project Folder and Choose the Run. Or Press F6.
- If you done any changes , Use F9 to complie and F6 run.
Now Create sucesfully created a Hellow World J2ME Application in one of Two Ways
Creating using Visual Mobile Designer is Another way to create application.
hi ur explaination was simple n helpful to me as im new to j2me but can i know how send a text message from mobile application to a system using j2me
ReplyDelete