1.系統要求
Pentium 100以上CPU
64MB 內存
Windows NT Workstation 4.0(Service Pack 3)或Windows 98
6 MB自由硬盤空間
Java 2 SDK, Standard Version, 版本1.2.2或者更高
2.安裝Java 2 SDK
在使用Motorola SDK之前必須安裝JDK,Standard Edition。請從http://java.sun.com/products/jdk 下載JDK,並按照Sun的指導安裝到PC中。
3.安裝Motorola SDK
安裝之前請先卸載以前版本的Motorola SDK:
1. 選擇"開始à設置à控制板"
2. 選擇"添加/刪除程序"
3. 查找到"Motorola SDK Components for the J2ME Platform"
4. 點擊"卸載"
5. 用資源管理器刪除"\MotoSDK"目錄
安裝SDK:
1. 運行"Motorola_SDK.exe"
2. 按照提示安裝程序
注意:安裝程序需要口令,請向Motorola公司索取。
4.編寫第一個程序
在目錄"\MotoSDK\demo\midlets\com\mot\j2me\midlets\tutorials\"中,用編輯器創建文件"HelloWorld.java"。
/*
* HelloWorld.java
*
* June 27, 2000
*
* ? Copyright 2000 Motorola, Inc. All Rights Reserved.
* This notice does not imply publication.
*/
package com.mot.j2me.midlets.tutorials;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
/**
* A simple Hello World midlet
*
* @see MIDlet
*/
public class HelloWorld extends MIDlet {
/**
* Main application screen
*/
private Form mainScreen;
/**
* A reference to the Display
*/
private Display myDisplay;
/**
* Creates a screen for our midlet
*/
HelloWorld() {
myDisplay = Display.getDisplay(this);
mainScreen = new Form("Hello World");
/*
* Create a string item
*/
StringItem strItem = new StringItem("Hello", "This is a J2ME MIDlet.");
mainScreen.append(strItem);
}
/**
* Start the MIDlet
*/
public void startApp() throws MIDletStateChangeException {
myDisplay.setCurrent(mainScreen);
}
/**
* Pause the MIDlet
*/
public void pauseApp() {
}
J2ME開發步驟
/**
* Called by the framework before the application is unloaded
*/
public void destroyApp(boolean unconditional) {
}
}
5.編譯
編譯"HelloWord"
1.在命令行窗口中,進入目錄"\MotoSDK\demo\midlets"
2.輸入"compileAll com\mot\j2me\midlets\tutorials\HelloWorld.java"
6.運行
運行"HelloWord"
1.在命令行窗口中,進入目錄"\MotoSDK\scripts"
2.輸入"runEmul com.mot.j2me.midlets.tutorials.HelloWorld"