怎么运行J2ME程序?

fbiboss 2010-11-17 11:47:59
我按照教程上的输入下面的代码,然后选择RUN AS -->Emulated J2ME midlet,出来模拟器不到1秒就关了,而且上面也没显示出你好,是怎么回事啊?

import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.TextBox;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class MyJavaMETest extends MIDlet {
private Display display;
private TextBox textbox;
public MyJavaMETest() {
display = Display.getDisplay(this);
// TODO Auto-generated constructor stub
textbox = new TextBox("", "", 500, 0);
display.setCurrent(textbox);
textbox.setTitle("J2ME程序");
textbox.setString("你好");
}
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
}
}
...全文
122 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
gj1111myl 2010-11-17
  • 打赏
  • 举报
回复
java.lang.Error: Unresolved compilation problem:
The public type MyJavaMETest must be defined in its own file


这句话的意思好像是
你那个类 必须 在 它自己的 文件中定义

是不是文件名和 类名 不一致?
gj1111myl 2010-11-17
  • 打赏
  • 举报
回复
结贴率 100.39% 是怎么算出来的…………?
houjin_cn 2010-11-17
  • 打赏
  • 举报
回复
这个是可以运行的;
你那里有错误信息输出吗?
fbiboss 2010-11-17
  • 打赏
  • 举报
回复
Running with storage root C:\Documents and Settings\Administrator\j2mewtk\2.5.2\appdb\MediaControlSkin
Running with locale: Chinese_People's Republic of China.936
Running in the identified_third_party security domain
java.lang.Error: Unresolved compilation problem:
The public type MyJavaMETest must be defined in its own file

at MyJavaMETest.<init>(+9)
at java.lang.Class.runCustomCode(+0)
at com.sun.midp.midlet.MIDletState.createMIDlet(+34)
at com.sun.midp.midlet.Scheduler.schedule(+52)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+80)
Execution completed.
3408692 bytecodes executed
38 thread switches
1667 classes in the system (including system classes)
17642 dynamic objects allocated (528668 bytes)
2 garbage collections (459552 bytes collected)
kf156 2010-11-17
  • 打赏
  • 举报
回复
看下控制台输出的什么错误或异常
xiang1115 2010-11-17
  • 打赏
  • 举报
回复
程序运行正常,可能是你配置什么地方出错了。

13,100

社区成员

发帖
与我相关
我的任务
社区描述
Java J2ME
社区管理员
  • J2ME社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧