發文作者:wekon | 九月 23, 2008

How to setup the Java ME development environment for eclipse

最近打算要用 eclipse 寫 Java ME 程式
看到了一篇文章寫得滿詳細的 [http://vlkgps.bielyvlk.sk/forum/viewtopic.php?p=419&sid=caa682d796d48666534b5e72a9cba268]
自己來試試看

安裝步驟
1. 安裝 java jdk
2. 安裝 java wireless toolkit for CLDC/CDC
3. 安裝 Eclipse
4. Eclipse ME

這部分稍微麻煩一些
因為新版的 Eclipse 安裝介面不太一樣
圖列如下:

5. configure eclipseme

  • Locate the file config.ini. This file is located in the <eclipse install>/configuration directory.
  • Edit the config.ini with your favorite text editor.
  • Add the property definition
    osgi.framework.extensions=eclipseme.core.hooks
    to the configuration file.
    If the property already exists, append ",eclipseme.core.hooks" to the end of the current property definition.It is very important that the line be added before the end-of-file marker. Failure to properly place the new line before the end-of-file marker could cause your Eclipse workbench to fail to start.
  • Save the configuration file.
  • Restart Eclipse.

接下來,這部分要參考以下網站: http://eclipseme.org/docs/configuring.html
實際操作如下:

6. 跑個測試看看

來段程式試試看

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class Hello extends MIDlet {

private Display display;

public Hello() {
display= Display.getDisplay(this);
}

public void startApp() {
TextBox t =new TextBox(“Hello MIDlet","Hello MIDP!", 256, 0);
display.setCurrent(t);
}

public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
}
}

做到這裡,根據所有的教學網頁,都說跑個 “run" 就可以出來了
的確,我有跑出來一次模擬器畫面
但是之後再怎麼試都不行了
出現 “<terminated> Hello [Wireless Toolkit Emulator] cmd" 的訊息
但是沒有半點錯誤報告顯示
不知道是不是哪裡的設定被動到
(印象中是沒有??)
沒辦法,只好用 Java wireless toolkit 的程式來看
步驟如下

終於,將結果跑了出來
完成開發環境建置


發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s

分類

%d 位部落客按了讚: