java.lang.ClassNotFoundException-平台:J2SE + WTK 出错:
源代码:
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class ScreenTest extends MIDlet implements CommandListener
{
private Display aDisplay;
private Command aCommand;
private Ticker aTicker;
private TextBox aTextBox;
public ScreenTest()
{
aCommand=new Command("Exit",Command.EXIT,2);
aTextBox=new TextBox("Hello World","Today's NASDAQ Market",256,0);
aTextBox.addCommand(aCommand);
aTextBox.setCommandListener(this);
aTicker=new Ticker("IBM 123.09,SUN 600.00,MS 00.00");
}
public void startApp()
{
aDisplay=Display.getDisplay(this);
aDisplay.setCurrent(aTextBox);
aTextBox.setTitle("dd");
aTextBox.setTicker(aTicker);
}
public void pauseApp()
{
}
public void destroyApp(boolean b)
{
}
public void commandAction(Command c,Displayable s)
{
if(c==aCommand)
{
destroyApp(false);
notifyDestroyed();
}
}
}
-----------------------------------------------------------------
运行出错如图:
http://home.ripway.com/2004-6/124062/5.jpg
------解决方法--------------------------------------------------------
估计是jar文件打包的不对,以至找不到要执行的MIDlet.
------解决方法--------------------------------------------------------
程序没有问题啊,你是不是把文件放在src文件夹下?
还有你在wtk下新建工程时候选的主类名是不是ScreenTest?