J2ME Wireless Toolkit (WTK) is a commonly used J2ME SDK, using WTK, can be compiled, verified, and running. Information about WTK can be queried with the following URL http://java.sun.com/products/j2mewtoolkit.
The latest version is WTK2.1, which supports JTWI (Wireless Industry Java Technical Specifications) RoadMap 1, CLDC1.1, and J2ME Web Services API. This article mainly introduces WTK2.0 versions, which supports many new technical specifications, such as MIDP2.0, mobile media API, wireless message API, etc.
Software download and installation
WTK2.0 requires support for JDK1.4, you can download JDK1.4 from the following URLs: http://java.sun.com/j2se/1.4.2/downloads/index.html
WTK2.0 can be downloaded from the following URL
Http://java.sun.com/products/j2mewtoolkit/download-2_0.html
After download, install the JDK first, then install the WTK. When you install the WTK, you will ask the JDK installation path, as shown in the following figure, please specify the correct JDK path in this step.
WTK2.0 can be used after the installation of the WTK2.0 environment is installed. First start KTOOLBAR, which is in the WTK20 / bin directory. The KTOOLBAR running window is shown below:
On the KTOOLBAR interface shown in the figure, the menu and toolbar are used to perform various features, including new projects, open engineering, compilation, packaging, deployment, etc. The drop-down list box is used to select the simulator used when running the application. The lowermost area displays the system console output. In KToolbar, select [File] | [Open Project] or click the [Open Project] button on the toolbar to pop up the window shown below. Select a project from the list list, such as "Photoalbum", click the [Open Project] button to open the project.
KTOOLBAR after opening the project As shown below, compare the interface of the KToolbar you can see that some of the originally unavailable buttons can now be used.
Click the [Run] button on the toolbar to pop up the simulator window. Use the mouse to click the [SELECT] key on the simulator or use the Enter key on the keyboard, you can select the project run in the simulator. The following figure is a snapshot in a movie application running.
WTK2.0 provides different simulators of four styles and complexes available, except for the default color simulator shown above, a black and white simulator, a media control simulator and a standard keyboard Simulator QWERTYDEVICE. Use the DEVICE drop-down list box on KToolbar to select different simulators. The QWERTYDEVICE simulator is shown below.
Here's how to use the WTK to compile the application that runs yourself. First give the Hello World program on your phone. Establish a source file to establish a file Hello.java, its contents are as follows: import javax.microedition.midlet.midlet; import javax.microedition.lcdui. *;
Public class hello extends midlet {private display display;
Public hello () {}
Public void startapp () {display = display.getdisplay (this); TextBox T = New TextBox ("Demo App", "Hello World", 256, 0); Display.SetCurrent (T);} public void pauseapp () { }
Public void destroyApp (Boolean Unconditional) {}} Compile Running In the KToolbar interface, click the [New Project] button to enter the data shown below in the pop-up window.
Then click [CREATE Project], the project setting window shown below will appear. In this window, you can set various properties of the project. At this time, first accept the default settings, click [OK] WTK to put all the projects in the WTK20 / Apps / Directory. Check this directory after creating an engineering, you will find more than a HelloWorld folder. There are four folders in this folder: SRC, RES, LIB, and BIN. Where "SRC" is used to store source files, "RES" resource files needed to save programs, "lib" storage program requires no files in these three directories when the project is created. There are two files, "manifest.mf" and "HelloWorld.jad" in the "bin" directory. "Manifest.mf" is a list file, records the various attribute information of the project, and the content of "HelloWorld.jad" is similar to "manifest.mf", which is used to download Java software from the Internet. The content of these two files can be modified with ordinary editing program or modified in the engineering settings window shown above. After creating the project, select the [Project] | [Settings ...] menu or click the [Settings ...] button on the toolbar, you can open the project setting window. Copy the hello.java file into the HelloWorld / SRC directory, and then click the [Build] button on the KToolbar to compile the source. If the source program has an error, the console displays the corresponding error message. If the compilation success will display the following information at the console:
After the Project Settings Saved Building "HelloWorld" build completion, the source program is compiled, click the [Run] button on the toolbar to run the program, click the [SELECT] button on the simulator to enter the program, as shown below.