当前位置: 技术问答>java相关
刚刚学习java,出了点问题,求助~~~~
来源: 互联网 发布时间:2015-09-25
本文导语: import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class MDIlet extends MIDlet implements CommandListener { private Command ExitCmd; private Display display; public MDIlet() { display=Display.getDisplay(this); ExitCmd=new Command("...
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class MDIlet extends MIDlet implements CommandListener
{
private Command ExitCmd;
private Display display;
public MDIlet()
{
display=Display.getDisplay(this);
ExitCmd=new Command("离开",Command.EXIT,1);
}
public void startApp()
{
TextBox main=new TextBox("Hello,this is my first app","Welecome to my first app!",256,0);
main.addCommand(ExitCmd);
main.setCommandListener(this);
display.setCurrent(main);
}
public void pauseApp()
{
}
public void destroyApp(boolean uncondition)
{
}
public void commandAction(Command cmd,Displayable s)
{
if(cmd==ExitCmd)
{
destroyApp(false);
notifyDestroyed();
}
}
}
照书上抄了个例子,能通过编译,但一运行就出下列提示:
Unable to create MIDlet MDIletApplication
java.lang.ClassNotFoundException: MDIletApplication
at com.sun.midp.midlet.Selector.commandAction(+47)
at javax.microedition.lcdui.Display$DisplayAccessor.commandAction(+152)
at com.sun.kvem.midp.lcdui.EmulEventHandler$EventLoop.run(+427)
这是什么错误?怎么改正?
import javax.microedition.lcdui.*;
public class MDIlet extends MIDlet implements CommandListener
{
private Command ExitCmd;
private Display display;
public MDIlet()
{
display=Display.getDisplay(this);
ExitCmd=new Command("离开",Command.EXIT,1);
}
public void startApp()
{
TextBox main=new TextBox("Hello,this is my first app","Welecome to my first app!",256,0);
main.addCommand(ExitCmd);
main.setCommandListener(this);
display.setCurrent(main);
}
public void pauseApp()
{
}
public void destroyApp(boolean uncondition)
{
}
public void commandAction(Command cmd,Displayable s)
{
if(cmd==ExitCmd)
{
destroyApp(false);
notifyDestroyed();
}
}
}
照书上抄了个例子,能通过编译,但一运行就出下列提示:
Unable to create MIDlet MDIletApplication
java.lang.ClassNotFoundException: MDIletApplication
at com.sun.midp.midlet.Selector.commandAction(+47)
at javax.microedition.lcdui.Display$DisplayAccessor.commandAction(+152)
at com.sun.kvem.midp.lcdui.EmulEventHandler$EventLoop.run(+427)
这是什么错误?怎么改正?
|
如果树上正确而且你没有抄错的话,看看你的classpath设置正确吗。
|
很多书上的东西不要相信,太多的毛病!
这个就很多问题,还是自己写吧!!
自己的调试,会学很多的东西!!!
这个就很多问题,还是自己写吧!!
自己的调试,会学很多的东西!!!
|
多运行几次,有时是jvm出问题.