Java Me Programming Steps
Figure 11.1 shows the Sun Java Wireless Toolkit©used to develop wireless applications that are based on Java ME's CLDC and MIDP. The toolkit includes the emulation environments, performance optimization and tuning features, documentation, and examples that developers need to bring efficient and successful wireless applications to market quickly. The following steps show how to develop an MIDP application, in this case a simple "Hello, World!" program, under Microsoft Windows XP:
Figure 11.1. A screenshot of KToolbar after launching © 2008 Sun Microsystems, Inc.
Download and install Sun Java Wireless Toolkit 2.3 Beta, which includes a set of tools and utilities and an emulator for creating Java applications that run on handheld devices, at the URL (http://java.sun.com/products/sjwtoolkit/download-2_3.html).
Run the development environment KToolbar of an MIDlet, an MIDP application, as shown in Figure 11.1 by selecting the following Windows options:
Start ⇒ All Programs ⇒ Sun Java Wireless Toolkit 2.3 Beta
⇒ KToolbarCreate a new project by giving a project name such as HelloSuite and a class name such as HelloMIDlet as shown in Figure 11.2. After the project HelloSuite is created, the KToolbar will display the message shown in Figure 11.3, which specifies where the Java source files, application resource files, and application library files are to be put.
Create a J2ME source program and place it in the directory of the local disk (C:\WTK23\apps\HelloSuite\src\). Figure 11.4 gives a J2ME example, which displays the text "Hello, World!" and a ticker with the message "Greeting, world."
Figure 11.2. A screenshot of the pop-up window obtained after clicking on the button "New Project" of KToolbar © 2008 Sun Microsystems, Inc.
Figure 11.3. A screenshot of KToolbar after the project HelloSuite is created © 2008 Sun Microsystems, Inc.
Figure 11.4. An example of a MIDlet program HelloMIDlet.java
Figure 11.5. The screenshot of an emulator displaying the execution results of HelloSuite © 2008 Sun Microsystems, Inc.
Build the project by clicking on the "Build" button. The "Build" includes compilation and pre-verifying.
Run the project by clicking on the "Run" button. An emulator will be popped up that displays the execution results of the built project. For example, Figure 11.5 shows an emulator displays the execution results of HelloSuite.
Upload the application to the handheld device using USB cables, infrared ports, or Bluetooth wireless technology.