当前位置: 代码迷 >> Java相关 >> [求助]编的一个ticker程序,出现classnotfound exception
  详细解决方案

[求助]编的一个ticker程序,出现classnotfound exception

热度:163   发布时间:2006-10-18 22:02:16.0
[求助]编的一个ticker程序,出现classnotfound exception

import javax.microedition.lcdui.*;

public class Displayable1 extends TextBox implements CommandListener {
Ticker ticker;
Command myCommand;

public Displayable1() {
super("welcome", "hello world", 150, TextField.ANY);
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}

private void jbInit() throws Exception {
// Set up this Displayable to listen to command events
setCommandListener(this);
// add the Exit command
addCommand(new Command("Exit", Command.EXIT, 1));
myCommand=new Command("Set Text",Command.OK,1);
ticker=new Ticker("hello every one I am wangwei!");
setTicker(ticker);
}

public void commandAction(Command command, Displayable displayable) {
/** @todo Add command handling code */
if(command==myCommand)
{
ticker.setString(getString());
}
if (command.getCommandType() == Command.EXIT) {
// stop the MIDlet
MIDlet1.quitApp();
}
}

}
另外一个定义MIDlet类的程序MIDlet.java
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class MIDlet1 extends MIDlet {
static MIDlet1 instance;
Displayable1 displayable = new Displayable1();
public MIDlet1() {
instance = this;
}

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

public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
}

public static void quitApp() {
instance.destroyApp(true);
instance.notifyDestroyed();
instance = null;
}

}

出现的错误:如下


D:\jbuilder2006\j2mewtk2.2\bin\emulator.exe -classpath "C:\Documents and Settings\WANG\jbproject\ticker\classes;" -Xdevice:MediaControlSkin -Xdescriptor:"C:\Documents and Settings\WANG\jbproject\ticker\jad-temp\ticker.jad"
正在通过存储根 MediaControlSkin 来运行
Unable to create MIDlet ticker.ticker
java.lang.ClassNotFoundException: ticker/ticker
at com.sun.midp.midlet.MIDletState.createMIDlet(+14)
at com.sun.midp.midlet.Selector.run(+22)
Execution completed.
698154 bytecodes executed
21 thread switches
741 classes in the system (including system classes)
3509 dynamic objects allocated (101500 bytes)
1 garbage collections (0 bytes collected)

[此贴子已经被作者于2006-10-19 11:13:40编辑过]

搜索更多相关的解决方案: ticker  exception  Exception  quot  

----------------解决方案--------------------------------------------------------
应该把你的异常信息帖出来啊
出在第几行啊
----------------解决方案--------------------------------------------------------
MIDlet1是什么
你还应该把你的所有程序文件帖出来
----------------解决方案--------------------------------------------------------
现在补完全了,呵呵,还请你们帮忙拉,
----------------解决方案--------------------------------------------------------
呵呵,大家互相学习吧
----------------解决方案--------------------------------------------------------
那还请兄弟帮哈忙嘎,看看应该怎么样改
----------------解决方案--------------------------------------------------------
  相关解决方案