Eclipse下编辑J2ME小程序,出现模拟器一闪就过得问题

    技术2022-05-11  66

    代码如下,应该没有错误吧!

    import javax.microedition.lcdui.*;import javax.microedition.midlet.MIDlet;import javax.microedition.midlet.MIDletStateChangeException;

    public class ExclusiveListMIDlet extends MIDlet implements CommandListener{ private Display display; public ExclusiveListMIDlet() {  // TODO Auto-generated constructor stub  display=Display.getDisplay(this);   Image img=null;  try{   img=Image.createImage("/a.png");     }catch(Exception e){   System.out.println(e);  }  List l=new List("d",Choice.EXCLUSIVE);  l.append("香蕉",null);  l.append("苹果",img);  l.append("西瓜",null);  l.addCommand(new Command("确定",Command.OK,1));  l.setCommandListener(this);  display.setCurrent(l); }

     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

     } public void commandAction(Command c,Displayable d){  String cmd=c.getLabel();  if (cmd.equals("确定"))  {   List l=(List)d;   int i=l.getSelectedIndex();   System.out.println("你选择了第"+i+"个选项!");   String con=l.getString(i);   System.out.println("内容为:"+con);  } }}相信代码没错吧,因为在WTK独立环境下测试,正常,但是在Eclipse3.2.1+EclipseME+WTK2.2+JDK1.4这个环境下,用Eclipse测试,模拟器一闪就关闭了,没有停下来,响应我的操作,又没有高手遇到过?下面将Eclipse的提示粘出来,供大家分析!

    正在通过存储根 DefaultColorPhone 来运行 java.io.IOException: storageOpen(): No such file or directory, C:/Documents and Settings/Administrator/workspace/???????/???????.jad at com.sun.midp.io.j2me.storage.RandomAccessStream.connect(+30) at com.sun.midp.dev.DevMIDletSuiteImpl.create(+141) at com.sun.midp.dev.DevMIDletSuiteImpl.create(+62) at com.sun.midp.main.Main.runLocalClass(+20) at com.sun.midp.main.Main.main(+116)Execution completed.649924 bytecodes executed0 thread switches740 classes in the system (including system classes)3179 dynamic objects allocated (83348 bytes)1 garbage collections (0 bytes collected)

    是哪一句出问题了?

     

    最新回复(0)