eclipse中配置j2me,简单运行j2me程序

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

你可能感兴趣的:(eclipse,list,import,download,Constructor,j2me)