我打算在j2me開始我的第一課,我下載了一本簡單的書,並嘗試了我的第一個程序。 當我走第二步添加命令,我面臨着一個錯誤信息是:J2ME未捕獲異常
uncaught exception java/lang/noclassdeffounderror: readfile.
所以,請你幫我理解這條消息?以及如何解決它? 請在下面找到我的代碼。
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class ReadFile extends MIDlet implements CommandListener
{
private Form form1;
private Command Ok, Quit;
private Display display;
private TextField text1;
public void startApp()
{
form1 = new Form("TA_Pog");
Ok = new Command("Ok", Command.OK, 1);
Quit = new Command("Quit", Command.EXIT, 2);
form1.setCommandListener(this);
form1.addCommand(Ok);
form1.addCommand(Quit);
text1 = new TextField("Put Your Name :","His Name : " , 32, TextField.URL);
form1.append(text1);
display = Display.getDisplay(this);
display.setCurrent(form1);
}
public void commandAction(Command c , Displayable d)
{
if (c == Ok)
{
Alert a = new Alert("Alert","This Alert from Ok Button", null, AlertType.ALARM);
a.setTimeout (3000);
display.setCurrent(a,this.form1);
}
else
{
this.notifyDestroyed();
}
}
public void pauseApp() {}
public void destroyApp(boolean bool) {}
}
注意:上面的代碼完全取自一本書。
在此先感謝 BESR認爲
你什麼時候得到這個例外 – 2012-01-03 08:23:40