eclipse中配置j2me,簡單運行j2me程式

來源:互聯網
上載者:User

1.安裝好jdk
2.去官網上下載好eclipse, 去eclipseme.org上下載eclipseme,http://www.oracle.com/technetwork/java/download-135801.html下載

(wiress toolkit)wtk,WTK需要安裝。
3.進入eclipse選擇help
4.選擇install new software
5.點擊add
6.在Add Repository中點擊archive...
7.選擇下載好的eclipseme.feature包,zip格式的
8.ok
9.選擇select all
10.next
11.next
12.選擇I accept the terms of the licese agreement
13.finish在安裝期間要連網,有東西從網上download
14.安裝完畢,選擇重啟eclipse
15.選擇window中的preferences
16.選擇j2me->Device Management->import
17.選擇你安裝好的wtk檔案夾,例如:D:/WTK2.5.2_01
18.Refresh
19.Select All
20.選擇一個裝置,預設就行
21.Apply
22.ok
23.選擇File->new->other->j2me->j2me midlet suite
24.next後輸入項目名稱,next,next
25.finish
26.項目建立完成,右鍵src->new->j2me->j2me midlet
27.name中輸入類名hello,finish
28.在hello中輸入

import javax.microedition.lcdui.Choice; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.List; import javax.microedition.midlet.MIDlet; import javax.microedition.midlet.MIDletStateChangeException; public class hello extends MIDlet { Display d = null; List list; public hello() { // TODO Auto-generated constructor stub } protected void destroyApp(boolean arg0) throws MIDletStateChangeException { // TODO Auto-generated method stub } protected void pauseApp() { // TODO Auto-generated method stub } protected void startApp() throws MIDletStateChangeException { // TODO Auto-generated method stub String []s={"hello","game"}; list=new List("我的遊戲", Choice.IMPLICIT, s, null); d=Display.getDisplay(this); d.setCurrent(list); } }

29.右鍵項目名run as->run configurations->右鍵wireless toolkit emulator->new
30.可以把name中的new_configuration改成你自己的名
31.在executable中選擇midlet->search
32.選擇hello,如果有包名,帶上包的名稱
33.ok
34.點擊apply
35.點擊run

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.