您的位置:jsp学习站首页 >> 框架/开源 >> JMX >> Jcreater+MotoJ2SDK的配置与使用心得

Jcreater+MotoJ2SDK的配置与使用心得 (1)

[ 来源:互网络 | 更新日期:2007-10-05 09:00:32 | 浏览次数:18522]
简介:3
假设安装路径如下:
JCreator D:Program FilesXinox SoftwareJCreator LE
motoj2sdk D:Motoj2sdk
JDK D:jdk1.3.1
注意:要先击活模拟环境,运行D:MotoJ2SDKgenericscripts unConstructor.bat
选择手机型号,选择语言,选择normal, 再"创建"。

启动Jcreater之后我的配置如下:
第一步 选择 Configure->Options->JDK Profiles
注意:一定新建 profile and select “D:jdk1.3.1”
将名字改为“J2ME 388”
Add classes path “D:Motoj2sdklib”
Add documentation path “D:Motoj2sdkdocs”
分别将后加的两行移到最上方.

第二步 选择 Configure->Options->JDK Tools
选择Complier
选中 and edit it.
将 parameters 变为 -classpath D:/motoj2sdk/lib $[JavaFiles]

第三步
选择 Configure->Options->Tools
点击“New”选择 DOS command
名字为“Preverifier”
将 arguments 换为 d:Motoj2sdkinpreverifier.exe -classpath "d:Motoj2sdklib" -d . .
将 initial directory 变为 “$[PrjDir]”


第4步

按上面的方法在New一个 DOS command
名字:“Run Emulator”
将 arguments 换成 “java -Djava.library.path=d:/MotoJ2SDK/lib -classpath "d:/MotoJ2SDK/bin/Emulator.jar";"d:/MotoJ2SDK/ConfigTool.jar" com.mot.tools.j2me.emulator.Emulator -classpath$[PrjDir];"d:/MotoJ2SDK/lib" -deviceFile d:/MotoJ2SDK/bin/resources/device.props javax.microedition.midlet.AppManager $[CurClass] -JSA 1 1”
将 initial directory 换成 “d:Motoj2sdkin”

ok!编辑工具配置完毕!

新建一个工程??选择Empty Project
再取一个名字 比如:test
则jcreater自动在你的工作目录中生成目录test
再new一个file选择java File
写好你的原代码,保存 如:test.java
在Project中 选add file
然后选中你刚才的test.java

注意:不要有package ;

编译??》tools中的Preverifier进行预先审核??》tools中的Run Emulator进行模拟

test.java 的例子:功能是捕捉键盘输入的ascII吗。

import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;


public class test extends MIDlet implements CommandListener {;

/**
* The screen for this MIDlet
*/
private KeyEventsDemoCanvas myCanvas;

/**
* Reference to current Display
*/
private Display myDisplay;

/**
* Command to make sure soft key is not a key event
*/
private Command okCommand = new Command("OK", Command.OK, 1);

test() {;

myDisplay = Display.getDisplay(this);
myCanvas = new KeyEventsDemoCanvas();
myCanvas.addCommand(okCommand);
myCanvas.setCommandListener(this);
};

/**
* Do nothing if a command is fired
*/
public void commandAction(Command c, Displayable s) {;
};

/**
* Start the MIDlet
*/
protected void startApp() throws MIDletStateChangeException {;

myDisplay.setCurrent(myCanvas);
};

/**
* Pause the MIDlet
*/
protected void pauseApp() {;
};

/**
* Called by the framework before the application is unloaded
*/
protected void destroyApp(boolean unconditional) {;
};

/**
* The screen for this application
*/
[1] [2]
Tags:关键字:Jcreater+MotoJ2SDK的配置与使用心得
责任编辑:glen