Abstract
preverify主要的功能是將原本在J2SE編譯過的class,檢查是否能在MIDP裝置正常執行。但儘管是最簡單的HelloWorld.class,也會出現『Segmentation fault』錯誤。
Introduction
執行環境:CentOS 5.1 + J2SE 1.4.2.17 + J2ME CLDC 1.1 + μCLinux 20070130
最簡單的HelloWorld,使用preverify就出現以下錯誤訊息。
[root@localhost uCLinux]# ./preverify -classpath classes.zip -verbose HelloWorld
[Output directory for verifIEd classes: output]
Segmentation fault
Solution
Step 1:
顯示你目前使用的語系
[root@localhost uCLinux]# echo $LANG
en_US.UTF-8
無論你使用中文或英文,只要使用了UTF-8,就會出現這個錯誤訊息。
Step 2:
暫時改成其他語系
[root@localhost uCLinux]# export LANG=en_US.ISO8859-1
[root@localhost uCLinux]# echo $LANG
en_US.ISO8859-1
Step 3:
順利執行preverify
[root@localhost uCLinux]# ./preverify -classpath classes.zip -verbose HelloWorld
[Output directory for verifIEd classes: output]
[Loaded Java/lang/Object] from [classes.zip]
[Loaded Java/lang/Class] from [classes.zip]
[Loaded Java/lang/String] from [classes.zip]
[Loaded Java/lang/Throwable] from [classes.zip]
[Loaded Java/lang/IllegalArgumentException] from [classes.zip]
[Loaded Java/lang/RuntimeException] from [classes.zip]
[Loaded Java/lang/Exception] from [classes.zip]
[Loaded Java/lang/StringIndexOutOfBoundsException] from [classes.zip]
[Loaded Java/lang/IndexOutOfBoundsException] from [classes.zip]
[Loaded Java/io/InputStream] from [classes.zip]
[Loaded com/sun/cldc/io/ResourceInputStream] from [classes.zip]
[Loaded ./HelloWorld.class]