J2ME编程问题,本人新手,高手进!200分

来源:百度知道 编辑:UC知道 时间:2024/05/28 13:27:17
J2ME的编程问题,源代码如下:
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

public class Test extends MIDlet {
private Display display;

public Test(){
super();
display = Display.getDisplay(this);
}

protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
}

protected void pauseApp() {
}

protected void startApp() throws MIDletStateChangeException {
Form form = new Form("测试……");
form.append("我的第一个J2ME Demo!");
display.setCurrent(form);
}

}

请问中间怎么运行啊?

我运行了之后出现如下错误:
正在通过存储根 DefaultColorPhone 来运行
Running with locale: Chinese_People's Republic of China.936
Running in the identified_third_party security domain
java.lang.InstantiationExcept

你索性下个JBuilder好了,06版本的JB是自带wtk的,不需要配置,具体下载地址:

http://58.61.39.221/down?cid=8C0FD92864931C1395C554E06BE05D5F19AF40C2&t=2&fmt=-

J2EE的,没看懂,赶快溜走

代码我运行了没有问题。我用的环境是eclipse3.2+WTK2.2.
J2ME配置:在装完J2ME插件和WTK后,在eclipse里,选择窗口--首选项--J2ME--Device Management--import然后导入WTK安装目录,然后刷新既可。

执行结果:
正在通过存储根 DefaultColorPhone 来运行
Execution completed.
712816 bytecodes executed
11 thread switches
740 classes in the system (including system classes)
3661 dynamic objects allocated (102788 bytes)
2 garbage collections (87272 bytes collected)

是这样的,我使用MIDlet的一个继承类,然后在培训这个文件属性的时候,我看见MIDlet下面的主程序选项,我以为需要选择MIDlet的主程序,于是选择了系统的MIDlet主程序,所以使用Debug project的时候,
始终不能找到自己的程序,于是连构造函数都不能进去。而我开始使用的调试方式是:
Micro Debug "**Main.java" using "Untitled Runtine Configuration,所