1. 開啟Blackberry JDK並選擇JDE
2. File => New
3. File => New
4. Finish
5. 在專案上按滑鼠右鍵(產生一個新的HelloWorld.java檔案)
HelloWorld.java
class HelloWorld extends net.rim.device.api.ui.UiApplication { public static void main(String[] args) { HelloWorld inst = new HelloWorld(); inst.enterEventDispatcher(); } public HelloWorld(){ pushScreen(new HelloWorldScreen()); } }
6. 在專案上按滑鼠右鍵(產生一個新的HelloWorldScreen.java檔案)
HelloWorldScreen.java
import net.rim.device.api.ui.*; import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.*; class HelloWorldScreen extends MainScreen { public HelloWorldScreen(){ super(); LabelField title = new LabelField("Hello World Application"); setTitle(title); RichTextField t = new RichTextField("Hello World!"); add(t); } public boolean onClose(){ System.exit(0); return true; } }
7. 編譯執行程式:Build => Build All and Run
執行程式時,程式會提示找不到HelloWorld.java檔案的位置,這時只要指到HelloWorld.java檔案存放的位置即可,進入模擬器後,選擇HelloWorld程式執行,如果沒看到安裝的HelloWorld程式,選擇File => Load Blackberry Application or Theme...並載入HelloWorld.cod即可