|||
前提:安装JDK,arm-linux-gcc
1.下载phoneme http://download.java.net/mobileembedded/phoneme/advanced/phoneme_advanced-mr2-dev-src-b97-20_nov_2008.zip
2.解压
unzip phoneme_advanced-mr2-dev-src-b97-20_nov_2008.zip
3.编译
cd phoneme_advanced_mr2/cdc/build/linux-arm-generic
gedit GNUmakefile
修改 CVM_TARGET_TOOLS_PREFIX=arm-linux- 为自己的交叉编译器的地址
修改 USE_AAPCS ?= false 为 true
修改 CVM_JIT?= true为 false
保存GUNmakefile。
make后在当前目录可以看到 bin lib testclasses.zip
4.测试
拷贝上面三个文件与文件夹到开发板/home/j2me目录。在开发板/etc/init.d/rcS文件里加入如下
JAVA_HOME=/home/j2me
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib
在终端中进入/home/j2me目录下 ./cvm -cp ../testclasses.zip Test 出现以下内容,恭喜你,成功!
*Number of command line arguments: 0
Starting test1
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...link
...link
...link
Starting test1 again
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...recurse
...link
...link
...link
test6: Caught inner java.lang.NullPointerException
test6: Caught outer java.lang.NullPointerException
Testing Array Copy
*TestE exception thrown because "I'm feeling Testy"
*<clinit> threw java.lang.ExceptionInInitializerError
*<clinit> threw java.lang.NoClassDefFoundError: StaticE
c1 = class [LTest;
c2 = class [[LTest;
c3 = class [LC;
c4 = class [[LC;
c1.modifiers = 1041
c2.modifiers = 1041
c3.modifiers = 1040
c4.modifiers = 1040
*FloatMIN =1.4E-45
*FloatMAX =3.4028235E38
FloatMIN (the int bits) =1
FloatMAX (the int bits) =2139095039
java.lang.IllegalArgumentException: too many dimensions
at java.lang.reflect.Array.multiNewArray(Native Method)
at java.lang.reflect.Array.newInstance(Unknown Source)
at Test.testDeepArrayConstruction(Unknown Source)
at Test.main(Unknown Source)
at sun.misc.CVM.runMain(Unknown Source)
Constructed an object of type [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[LTest;
finally!
Requesting GC with a latency request of 2 seconds
(Turning GC tracing on)
Sleeping 5 seconds, and waiting for GC's
Woke up! Cancelling latency request
.............
*CONGRATULATIONS: test Test completed with 411 tests passed and 0 failures
*Output lines starting with a * should be checked for correctness
*They can be compared to src/share/javavm/test/TestExpectedResult
备注:如果碰到问题,欢迎留言交流!