Java ME MIDP Development Quick Start Guide
This tutorial guides you through the basic steps of using NetBeans IDE to create a Java™ Platform, Micro Edition (Java™ ME platform),
Mobile Information Device Profile (MIDP) application and is designed to get you started with mobile application development as quickly as possible. The tutorial takes you through some of the basic steps of working with the project system. We show you two ways to create a Java ME MIDP project named "MyHello" that displays the text "Make My Day" in a device emulator. This tutorial prepares you to use other IDE features for developing CLDC/MIDP applications.
Contents
Requirements
To complete this tutorial, you need the following software and resources:
Note: the emulator bundled with the IDE varies depending on which operating system installer is downloaded.
- The Windows distribution of NetBeans 6.7 and later comes bundles with the Java ME SDK 3.0.
- The Linux distribution of NetBeans IDE is bundled with the Sun Java Wireless Toolkit 2.5.2.
- The MacOS X version of NetBeans 6.9 is bundled with the Java ME SDK 3.0 for CLDC.
Creating a MIDP Application Using the Visual Mobile Designer
The NetBeans IDE provides a wizard that enables you to quickly create a MIDP project. When creating the project, you can choose to develop
your application in the Visual Mobile Designer (VMD) or in the Source Code Editor. Using the VMD gives you the ability to visually plan out
the flow of the application and design the screens the application uses. The designer automatically creates the code for the application as
changes are saved on the design canvas.
Creating a MIDP/CLDC Application
- Choose File > New Project (Ctrl+Shift+N). Under Categories, select Java ME. Under Projects, select Mobile Application and click Next.
- Enter
MyHello in the Project Name field. Use the default Project Location, or change it to the directory you prefer on your system. In this tutorial we refer to this directory as $PROJECTHOME.
- Check the Set as Main Project and Create Hello MIDlet check boxes (both are checked by default). Click Next.
- Select the default as the emulator platform and use the remaining defaults. Click Finish.
- The IDE creates the
$PROJECTHOME/MyHello project folder. The project folder contains all of your sources and project metadata,
such as the project Ant script. The application itself is displayed in the Flow Design window of the Visual Mobile Designer.

Note: for a complete description of the available palette components, please refer to the Visual Mobile Designer Palette Reference.
Editing the Java Source Code
Now let's edit the text displayed by the MIDlet.
- Under HelloMIDlet.java click Screen to show the Screen Designer window diplaying the Device Screen, which is the only screen available in the application.
- Click the "Hello World!" message in the Device Screen. In the Properties window click the "Hello World!" text and change the welcome message text. In this example we typed "Make my day".

- The Screen view displays a preview of the text you enter in the Text field.

Compiling and Running the Project
- Choose Run > Run Main Project (F6) from the Run menu. Follow the progress of the project compilation in the Output window. Note that the
HelloMIDlet.java
file is built before it is executed. A device emulator opens to display the results of the executed MIDlet. The device emulator launches the MIDlet
and displays the text you entered in the source code.
Tip: you can specify the emulator to run the MIDlet on by right-clicking the project node and selecting Run With.. from the contextual menu. The DefaultFXPhone1 available in the Java ME SDK 3.0 is shown below.

- Click on the button below Exit to close the MIDlet. Then click on the button in the upper right corner of the device to close the emulator window.
Using the Source Code Editor, you manually create the code for your MIDlets. Creating code in the Source Code Editor gives you more flexibility when editing
the code, and enables you to insert preprocessor code blocks. Next we create the MyHello application using the New Project and New File wizards,
and complete the code using the Source Editor.
For more tutorials showing how to developing MIDP and CLDC applications visit the Mobile Application Learning trail.