日期:2014-05-20  浏览次数:20896 次

eclipse Pulsar 3.6 下开发j2me 时配置文件中写明cldc 1.1 但是Math 包不能使用Math.PI等浮点类型的常量和方法
使用Eclipse 3.6 Helios Service Release 2  
J2ME SDK 3.0 
eclipse j2me 1.7.9 
配置文件Application descriptor 如下:
MIDlet-1: Main,,com.pdsu.main.Main
MIDlet-Jar-URL: BulletFly.jar
MIDlet-Name: BulletFly MIDlet Suite
MIDlet-Vendor: MIDlet Suite Vendor
MIDlet-Version: 1.0.0
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.1

bulid.properties

# MTJ Build Properties
DefaultCldcPhone1.includes=src/com/pdsu/main/Main.java\
,src/com/pdsu/view/ChoiceForm.java\

DefaultCldcPhone1.excludes=\


中使用 Math包中的浮点运算时 就报错:

Multiple markers at this line
- Syntax error, insert 
"AssignmentOperator Expression" to complete 
Expression
- PI cannot be resolved or is not a 
field

------解决方案--------------------
使用定点数代替浮点数!
------解决方案--------------------
估计就是你的项目配置问题,cldc1.0是不支持浮点数的,你的wtk配置的cldc1.1,Java_ME_platform_SDK_3.0配置的可能是cldc1.0
------解决方案--------------------
我遇到过类似的问题
http://topic.csdn.net/u/20110415/10/3874a98e-9315-48d9-96db-c8bc4346a438.html

remove the cldc_1.0.jar

你参考一下试一试