百分相赠:helloworld问题

茂一茂 2006-02-19 11:07:05
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class helloWorld extends MIDlet implements CommandListener
{
private Form mainForm;

private StringItem helloString;


public helloWorld(){
mainForm = new Form("Hello World Form");
mainForm.addCommand( new Command("Beenden", Command.EXIT, 0));
mainForm.setCommandListener(this);


helloString = new StringItem("Hello Label","\nHello World!");

mainForm.append(helloString);
}

public void commandAction(Command c, Displayable d) {
if (c.getCommandType() == c.EXIT ) {
destroyApp(false);
notifyDestroyed();
}
}

public void startApp() {
Display.getDisplay(this).setCurrent(mainForm);
}

public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
}



上面是在网上拷来的
在Sun Java Wireless Toolkit运行时

出来以下错误 :
Unable to create MIDlet helloWorld_MIDlet
java.lang.ClassNotFoundException: helloWorld_MIDlet
at com.sun.midp.midlet.MIDletState.createMIDlet(+29)
at com.sun.midp.midlet.Selector.run(+22)

是不是有什么问题呀?
...全文
92 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
fronlin 2006-03-07
  • 打赏
  • 举报
回复
是那个"if (c.getCommandType() == c.EXIT ) {"这句错了。应该改成“if (c.getCommandType() == Command.EXIT ) {”就对了。
茂一茂 2006-02-19
  • 打赏
  • 举报
回复
嘿嘿,看到了,谢谢
appleangle 2006-02-19
  • 打赏
  • 举报
回复
呵呵。。程序员第一要细心
aaa2003gf 2006-02-19
  • 打赏
  • 举报
回复
大哥,你的类名不对啊 helloWorld_MIDlet
aaa2003gf 2006-02-19
  • 打赏
  • 举报
回复
这个分太多啦点,不好意思啊.

13,097

社区成员

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

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