编译OK,,但是运行保持,怎么回事呀?
来源:互联网 发布:asp.net mvc4高级编程 编辑:程序博客网 时间:2024/05/02 04:23
Unable to create MIDlet HelloMidlet
java.lang.ClassNotFoundException: HelloMidlet
at com.sun.midp.midlet.MIDletState.createMIDlet(+29)
at com.sun.midp.midlet.Selector.run(+22)
网上找到代码如下: 编译没有问题,,但是在虚拟机器上一运行,就报上面的错。怎么回事呢?
/*
* HelloMidlet.java
*
* Created on 2007年1月26日, 下午12:34
*/
package hello;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
*
* @author zhhz
*/
public class HelloMidlet extends MIDlet implements CommandListener {
/** Creates a new instance of HelloMidlet */
public HelloMidlet() {
}
private Form helloForm;
private StringItem helloStringItem;
private Command exitCommand;
private Form form1;
private Command exitCommand1;
private ChoiceGroup choiceGroup1;
private TextField textField1;
private TextField textField2;
private Command okCommand1;
private Command cancelCommand1;
private Command cancelCommand2;
private Command okCommand2;
private Command okCommand3;
/** This method initializes UI of the application.
*/
private void initialize() {
// Insert pre-init code here
getDisplay().setCurrent(get_helloForm());
// Insert post-init code here
}
/** Called by the system to indicate that a command has been invoked on a particular displayable.
* @param command the Command that ws invoked
* @param displayable the Displayable on which the command was invoked
*/
public void commandAction(Command command, Displayable displayable) {
// Insert global pre-action code here
if (displayable == helloForm) {
if (command == exitCommand) {
// Insert pre-action code here
getDisplay().setCurrent(get_form1());
// Insert post-action code here
}
} else if (displayable == form1) {
if (command == exitCommand1) {
// Insert pre-action code here
exitMIDlet();
// Insert post-action code here
} else if (command == okCommand3) {
// = "/u8BF7/u8F93/u5165/u59D3/u540D/uFF1A"; // Insert pre-action code here
// Do nothing
// Insert post-action code here
}
}
// Insert global post-action code here
}
/**
* This method should return an instance of the display.
*/
public Display getDisplay() {
return Display.getDisplay(this);
}
/**
* This method should exit the midlet.
*/
public void exitMIDlet() {
getDisplay().setCurrent(null);
destroyApp(true);
notifyDestroyed();
}
/** This method returns instance for helloForm component and should be called instead of accessing helloForm field directly.
* @return Instance for helloForm component
*/
public Form get_helloForm() {
if (helloForm == null) {
// Insert pre-init code here
helloForm = new Form(null, new Item[] {
get_helloStringItem(),
get_choiceGroup1()
});
helloForm.addCommand(get_exitCommand());
helloForm.setCommandListener(this);
// Insert post-init code here
}
return helloForm;
}
/** This method returns instance for helloStringItem component and should be called instead of accessing helloStringItem field directly.
* @return Instance for helloStringItem component
*/
public StringItem get_helloStringItem() {
if (helloStringItem == null) {
// Insert pre-init code here
helloStringItem = new StringItem("Hello", "Hello, World!");
// Insert post-init code here
}
return helloStringItem;
}
/** This method returns instance for exitCommand component and should be called instead of accessing exitCommand field directly.
* @return Instance for exitCommand component
*/
public Command get_exitCommand() {
if (exitCommand == null) {
// Insert pre-init code here
exitCommand = new Command("NEXT", Command.EXIT, 1);
// Insert post-init code here
}
return exitCommand;
}
/** This method returns instance for form1 component and should be called instead of accessing form1 field directly.
* @return Instance for form1 component
*/
public Form get_form1() {
if (form1 == null) {
// Insert pre-init code here
form1 = new Form(null, new Item[] {
get_textField1(),
get_textField2()
});
form1.addCommand(get_exitCommand1());
form1.addCommand(get_okCommand3());
form1.setCommandListener(this);
// Insert post-init code here
}
return form1;
}
/** This method returns instance for exitCommand1 component and should be called instead of accessing exitCommand1 field directly.
* @return Instance for exitCommand1 component
*/
public Command get_exitCommand1() {
if (exitCommand1 == null) {
// Insert pre-init code here
exitCommand1 = new Command("exit", Command.EXIT, 1);
// Insert post-init code here
}
return exitCommand1;
}
/** This method returns instance for choiceGroup1 component and should be called instead of accessing choiceGroup1 field directly.
* @return Instance for choiceGroup1 component
*/
public ChoiceGroup get_choiceGroup1() {
if (choiceGroup1 == null) {
// Insert pre-init code here
choiceGroup1 = new ChoiceGroup("asdfasdfkasd;k f/ndsfasd/nf/nas/ndf/na/n/n", Choice.MULTIPLE, new String[0], new Image[0]);
choiceGroup1.setSelectedFlags(new boolean[0]);
// Insert post-init code here
}
return choiceGroup1;
}
/** This method returns instance for textField1 component and should be called instead of accessing textField1 field directly.
* @return Instance for textField1 component
*/
public TextField get_textField1() {
if (textField1 == null) {
// Insert pre-init code here
textField1 = new TextField("/u8BF7/u8F93/u5165/u59D3/u540D/uFF1A", "", 120, TextField.ANY);
// Insert post-init code here
}
return textField1;
}
/** This method returns instance for textField2 component and should be called instead of accessing textField2 field directly.
* @return Instance for textField2 component
*/
public TextField get_textField2() {
if (textField2 == null) {
// Insert pre-init code here
textField2 = new TextField("/u8BF7/u8F93/u5165/u5BC6/u7801/uFF1A", null, 120, TextField.ANY);
// Insert post-init code here
}
return textField2;
}
/** This method returns instance for okCommand1 component and should be called instead of accessing okCommand1 field directly.
* @return Instance for okCommand1 component
*/
public Command get_okCommand1() {
if (okCommand1 == null) {
// Insert pre-init code here
okCommand1 = new Command("cancle", Command.OK, 1);
// Insert post-init code here
}
return okCommand1;
}
java.lang.ClassNotFoundException: HelloMidlet
at com.sun.midp.midlet.MIDletState.createMIDlet(+29)
at com.sun.midp.midlet.Selector.run(+22)
网上找到代码如下: 编译没有问题,,但是在虚拟机器上一运行,就报上面的错。怎么回事呢?
/*
* HelloMidlet.java
*
* Created on 2007年1月26日, 下午12:34
*/
package hello;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
*
* @author zhhz
*/
public class HelloMidlet extends MIDlet implements CommandListener {
/** Creates a new instance of HelloMidlet */
public HelloMidlet() {
}
private Form helloForm;
private StringItem helloStringItem;
private Command exitCommand;
private Form form1;
private Command exitCommand1;
private ChoiceGroup choiceGroup1;
private TextField textField1;
private TextField textField2;
private Command okCommand1;
private Command cancelCommand1;
private Command cancelCommand2;
private Command okCommand2;
private Command okCommand3;
/** This method initializes UI of the application.
*/
private void initialize() {
// Insert pre-init code here
getDisplay().setCurrent(get_helloForm());
// Insert post-init code here
}
/** Called by the system to indicate that a command has been invoked on a particular displayable.
* @param command the Command that ws invoked
* @param displayable the Displayable on which the command was invoked
*/
public void commandAction(Command command, Displayable displayable) {
// Insert global pre-action code here
if (displayable == helloForm) {
if (command == exitCommand) {
// Insert pre-action code here
getDisplay().setCurrent(get_form1());
// Insert post-action code here
}
} else if (displayable == form1) {
if (command == exitCommand1) {
// Insert pre-action code here
exitMIDlet();
// Insert post-action code here
} else if (command == okCommand3) {
// = "/u8BF7/u8F93/u5165/u59D3/u540D/uFF1A"; // Insert pre-action code here
// Do nothing
// Insert post-action code here
}
}
// Insert global post-action code here
}
/**
* This method should return an instance of the display.
*/
public Display getDisplay() {
return Display.getDisplay(this);
}
/**
* This method should exit the midlet.
*/
public void exitMIDlet() {
getDisplay().setCurrent(null);
destroyApp(true);
notifyDestroyed();
}
/** This method returns instance for helloForm component and should be called instead of accessing helloForm field directly.
* @return Instance for helloForm component
*/
public Form get_helloForm() {
if (helloForm == null) {
// Insert pre-init code here
helloForm = new Form(null, new Item[] {
get_helloStringItem(),
get_choiceGroup1()
});
helloForm.addCommand(get_exitCommand());
helloForm.setCommandListener(this);
// Insert post-init code here
}
return helloForm;
}
/** This method returns instance for helloStringItem component and should be called instead of accessing helloStringItem field directly.
* @return Instance for helloStringItem component
*/
public StringItem get_helloStringItem() {
if (helloStringItem == null) {
// Insert pre-init code here
helloStringItem = new StringItem("Hello", "Hello, World!");
// Insert post-init code here
}
return helloStringItem;
}
/** This method returns instance for exitCommand component and should be called instead of accessing exitCommand field directly.
* @return Instance for exitCommand component
*/
public Command get_exitCommand() {
if (exitCommand == null) {
// Insert pre-init code here
exitCommand = new Command("NEXT", Command.EXIT, 1);
// Insert post-init code here
}
return exitCommand;
}
/** This method returns instance for form1 component and should be called instead of accessing form1 field directly.
* @return Instance for form1 component
*/
public Form get_form1() {
if (form1 == null) {
// Insert pre-init code here
form1 = new Form(null, new Item[] {
get_textField1(),
get_textField2()
});
form1.addCommand(get_exitCommand1());
form1.addCommand(get_okCommand3());
form1.setCommandListener(this);
// Insert post-init code here
}
return form1;
}
/** This method returns instance for exitCommand1 component and should be called instead of accessing exitCommand1 field directly.
* @return Instance for exitCommand1 component
*/
public Command get_exitCommand1() {
if (exitCommand1 == null) {
// Insert pre-init code here
exitCommand1 = new Command("exit", Command.EXIT, 1);
// Insert post-init code here
}
return exitCommand1;
}
/** This method returns instance for choiceGroup1 component and should be called instead of accessing choiceGroup1 field directly.
* @return Instance for choiceGroup1 component
*/
public ChoiceGroup get_choiceGroup1() {
if (choiceGroup1 == null) {
// Insert pre-init code here
choiceGroup1 = new ChoiceGroup("asdfasdfkasd;k f/ndsfasd/nf/nas/ndf/na/n/n", Choice.MULTIPLE, new String[0], new Image[0]);
choiceGroup1.setSelectedFlags(new boolean[0]);
// Insert post-init code here
}
return choiceGroup1;
}
/** This method returns instance for textField1 component and should be called instead of accessing textField1 field directly.
* @return Instance for textField1 component
*/
public TextField get_textField1() {
if (textField1 == null) {
// Insert pre-init code here
textField1 = new TextField("/u8BF7/u8F93/u5165/u59D3/u540D/uFF1A", "", 120, TextField.ANY);
// Insert post-init code here
}
return textField1;
}
/** This method returns instance for textField2 component and should be called instead of accessing textField2 field directly.
* @return Instance for textField2 component
*/
public TextField get_textField2() {
if (textField2 == null) {
// Insert pre-init code here
textField2 = new TextField("/u8BF7/u8F93/u5165/u5BC6/u7801/uFF1A", null, 120, TextField.ANY);
// Insert post-init code here
}
return textField2;
}
/** This method returns instance for okCommand1 component and should be called instead of accessing okCommand1 field directly.
* @return Instance for okCommand1 component
*/
public Command get_okCommand1() {
if (okCommand1 == null) {
// Insert pre-init code here
okCommand1 = new Command("cancle", Command.OK, 1);
// Insert post-init code here
}
return okCommand1;
}
0 0
- 编译OK,,但是运行保持,怎么回事呀?
- VS2013+opencv3.0+QT5.7编译ok但是运行产生0xc000007b错误的解决方法
- vc2005本机编译和运行程序都ok,但是将编译好的程序拿到其它机器上确无法运行
- 好气呀,但是要保持微笑
- Windows版本openssl程序本地运行OK,但是在有些机器上main 函数之前就奔溃
- 【运行程序频繁自动更新怎么回事?】
- 黑莓程序可以编译但是不能运行,显示preverifying错误
- 项目在Xcode7.2编译正常,但是运行报错。
- Xcode能编译运行成功,但是模拟器没有任何反应
- caffe windows 编译成功,但是运行时遇到GPU错误
- IDEA编译通过能运行但是出现红色下划线
- 怎么回事?
- 怎么回事
- 怎么回事?
- 怎么回事?
- 怎么回事?
- 怎么回事?
- 怎么回事?
- J2ME Vector元素转换为int 问题
- poj2549 Sumsets双向搜索
- 如何屏蔽控件的按键响应
- 请推荐几个好的关于BREW开发的网站,谢谢!
- android_25_HttpURLConnection
- 编译OK,,但是运行保持,怎么回事呀?
- 数据可视化matplotlib的应用(四)
- Ubuntu 14.04 64bit 安装Caffe(GPU版本)--台式机(笔记本请绕道)
- 求一个手机上的飞机小游戏
- (一)Centos7下 Tengine安装和配置
- Linux下C语言连接MySQL
- dvwa文件包含漏洞和远程文件利用漏洞
- [Java 8] (1) 函数式编程简介
- 在ECLIPSE中为什么导不出SOCKETCONNECTION 急啊