- 論壇徽章:
- 0
|
一、選用sun的phoneme
https://phoneme.dev.java.net/
二、下載
http://download.java.net/mobileembedded/phoneme/advanced/phoneme_advanced-mr2-dev-src-b97-20_nov_2008.zip
三、解壓
unzip phoneme_advanced-mr2-dev-src-b97-20_nov_2008.zip
四、修改makefile
cd phoneme_advanced_mr2/cdc/build/linux-arm-generic
gedit GNUmakefile
修改 CVM_TARGET_TOOLS_PREFIX=/usr/local/arm/4.3.2/bin/arm-linux- 為自己的交叉編譯器的地址
修改 USE_AAPCS ?= false 為 true
五、輸出PATH
export PATH=/usr/local/arm/4.3.2/bin/:$PATH 為自己的交叉編譯器的地址
六、編譯
make
七、如果是使用ubuntu的朋友,可能要安裝sun-java6-jdk和另外的一兩個工具
Java SDK安裝配置
http://wiki.ubuntu.org.cn/Java%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE
另外的一兩個工具可以通過 apt-get install 來安裝(出錯時(shí)會提醒的了,具體我忘了,沒有記錄)
八、出錯
../../src/linux-arm/javavm/runtime/segvhandler_arch.c:45:26: error: asm/ucontext.h: No such file or directory
../../src/linux-arm/javavm/runtime/segvhandler_arch.c: In function 'handleSegv':
../../src/linux-arm/javavm/runtime/segvhandler_arch.c:224: error: dereferencing pointer to incomplete type
../../src/linux-arm/javavm/runtime/segvhandler_arch.c:285: error: dereferencing pointer to incomplete type
../../src/linux-arm/javavm/runtime/segvhandler_arch.c:285: error: dereferencing pointer to incomplete type
../../src/linux-arm/javavm/runtime/segvhandler_arch.c:286: error: dereferencing pointer to incomplete type
../../src/linux-arm/javavm/runtime/segvhandler_arch.c:294: error: dereferencing pointer to incomplete type
修改 segvhandler_arch.c 文件
gedit ../../src/linux-arm/javavm/runtime/segvhandler_arch.c
修改
#define ucontext asm_ucontext
#include
為
//#define ucontext asm_ucontext //注釋掉這句
#include //去掉arm/
九、編譯
make
編譯成功!
ls
可以看到在當(dāng)前目錄有
bin lib testclasses.zip
十、測試
1)、拷貝上面三個文件與文件夾到開發(fā)板/home/j2me目錄
2)、在開發(fā)板/etc/init.d/rcS文件里加入如下
JAVA_HOME=/home/j2me
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib
3)、經(jīng)典的HelloWorld
cd /home/j2me/bin
./cvm -cp ../testclasses HelloWorld
可以看到輸出了 HelloWorld.
4)、來個全面測試
./cvm -cp ../testclasses.zip Test
*Number of command line arguments: 0
Starting test1
...recurse
...recurse
...recurse
...link
...link
...link
Starting test1 again
...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"
* threw java.lang.ExceptionInInitializerError
* 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
*CONGRATULATIONS: test Test completed with 411 tests passed and 0 failures
這句話意味著什么,我就不說了~~ 恭喜你!
本文來自ChinaUnix博客,如果查看原文請點(diǎn):http://blog.chinaunix.net/u1/49274/showart_2058477.html |
|