In this section you create the example application from scratch. Note that this section only presents one possible way of creating the required functions.
To create a new MIDP project:
In the Eclipse menu bar, select File > New > Project.
Select J2ME > J2ME MIDlet suite
In the window that opens, fill in the necessary project information such as the name of the project, the SDK version to be used, etc.
Click Finish to complete the project creation.
The project appears in Eclipse Package Explorer view.
To create source files for the project:
In the Eclipse Package
Explorer view, select the project you just created. Select the src
folder.
In the Eclipse menu bar, select File > New > Package
Give the new
package a name, in this case example.hello
.
Keep the package
selected. In the Eclipse menu bar, select File > New > Class to create
the HelloWorldMIDlet.java
class. Repeat the step for
the HelloScreen.java
class.
Write or copy
the code in the *.java
files. Save the changes, for example
by closing the class and then answering yes when prompted to save changes.
To build source files for the project:
In the Eclipse Package Explorer view, select the project.
In the Eclipse menu bar, select Project > Build Project.
Depending
on the environment, the built class files can be found, for example, in a
folder called preverified-temp
or in a bin
folder
accessible in the Eclipse Package Explorer view.
To run the application:
In the Eclipse Package Explorer view, right-click the project and select Run as...> Run.
Create a new Run configuration for the project by selecting New and then Run.
The emulator opens and the application starts.
Test that the application works as described.
To deploy the application to a mobile device:
To deploy the application to a mobile device, follow the procedures described in section Deploying MIDlets to a device.