所有我正在J2ME-Polih2.1.4中创建一个新项目,当我使用J2ME-Pulih2.1.4创建新项目时,构建是成功的,但当我运行此代码时,我会看到有关浮点常量的错误,详细信息如下。
如何从这个问题中恢复?
`J2ME Polish 2.1.4 (2010-01-18) (GPL License)
Loading device database...
Last build was interrupted or failed, now clearing work directory...
using locale [en_US]...
assembling resources for device [Nokia/7610].
preprocessing for device [Nokia/7610].
processing locale code...
compiling for device [Nokia/7610].
warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
Compiling 428 source files to D:FarazdevelopmentJ2ME-Polish-ProjectaaaabuildtestNokia7610en_USclasses
preverifying for device [Nokia/7610].
preverify:ERROR: floating-point constants should not appear
preverify:Error preverifying class de.enough.polish.ui.screenanimations.CubeScreenChangeAnimation
Preverify call failed: 1
C:WTK2.5.1binpreverify.exe -classpath d:J2ME-Polish2.1.4importmmapi.jar;d:J2ME-Polish2.1.4importcldc-1.0.jar;d:J2ME-Polish2.1.4importmidp-2.0.jar;d:J2ME-Polish2.1.4importnokia-ui.jar;d:J2ME-Polish2.1.4importwmapi-2.0.jar;d:J2ME-Polish2.1.4importwmapi.jar;d:J2ME-Polish2.1.4importbtapi.jar;d:J2ME-Polish2.1.4importm3g.jar;d:J2ME-Polish2.1.4importjsr172.jar;d:J2ME-Polish2.1.4importfileconnection.jar;d:J2ME-Polish2.1.4importpim.jar;d:J2ME-Polish2.1.4importm2g.jar -d D:FarazdevelopmentJ2ME-Polish-ProjectaaaabuildtestNokia7610en_USclasses -nofp -nofinalize -nonative D:FarazdevelopmentJ2ME-Polish-ProjectaaaabuildtestNokia7610en_USclasses
D:FarazdevelopmentJ2ME-Polish-Projectaaaabuild.xml:87: Unable to preverify for device [Nokia/7610] - preverify returned result 1
BUILD FAILED (total time: 9 seconds)
`
如果您更深入地研究preferify类路径,就会发现导致错误的原因。
C:WTK2.5.1binpreverify.exe -classpath d:J2ME-Polish2.1.4importmmapi.jar;d:J2ME-Polish2.1.4importcldc-1.0.jar;d:J2ME-Polish2.1.4importmidp-2.0.jar;d:J2ME-Polish2.1.4importnokia-ui.jar;d:J2ME-Polish2.1.4importwmapi-2.0.jar;d:J2ME-Polish2.1.4importwmapi.jar;d:J2ME-Polish2.1.4importbtapi.jar;d:J2ME-Polish2.1.4importm3g.jar;d:J2ME-Polish2.1.4importjsr172.jar;d:J2ME-Polish2.1.4importfileconnection.jar;d:J2ME-Polish2.1.4importpim.jar;d:J2ME-Polish2.1.4importm2g.jar -d D:FarazdevelopmentJ2ME-Polish-ProjectaaaabuildtestNokia7610en_USclasses -nofp -nofinalize -nonative D:FarazdevelopmentJ2ME-Polish-ProjectaaaabuildtestNokia7610en_USclasses
上面提到的是cldc-1.0.jar
,这意味着您的构建是为CLDC 1.0配置的,实际上不支持浮点。这就是您的构建失败的原因。
要修复它,可以在应用程序中去掉浮点代码,也可以使用允许浮点和双精度的CLDC 1.1。