Sun WTK Preverify在J2ME-java / lang / NoClassDefFoundError中失败

时间:2012-06-15 05:26:41

标签: ant java-me midp java-wireless-toolkit

我编写了ANT脚本来预验证类。

 <property name="wtkHome" location="C:/WTK2.5.2"> </property>
 <property name="midp_lib" value="${wtkHome}/lib/midpapi21.jar"></property>
   .... 
  ........
<property name="build" value="build"/>
.....
   ......    

    <target name="preverify">
            <mkdir dir="${build}/preverified"/>
                <exec executable="${wtkHome}/bin/preverify">
                  <arg line="-classpath ${wtkHome}/lib"/>
             (or) <arg line="-classpath ${midp_lib}"/>
                  <arg line="-d ${build}/preverified"/>
                  <arg line="${build}/classes"/>
                </exec>
        </target>

当上面的脚本执行时,它无法在类路径中找到midp类,因此它显示错误,

[exec] Error preverifying class first.MCCanvas
[exec] java/lang/NoClassDefFoundError: javax/microedition/lcdui/Canvas
[exec] Result: 1

但是所需的库都在类路径中,请注意编译适用于MIDlet和Canvas类!

2 个答案:

答案 0 :(得分:1)

你为什么不使用天线? http://antenna.sourceforge.net/

您的构建脚本将使用:


    <wtkpreverify cldc="CLDC-1.0" srcdir="${build}/classes" destdir="${build}/preverified" classpath="${wtk.home}/lib/cldcapi11.jar;${wtk.home}/lib/midpapi20.jar" />

答案 1 :(得分:0)

尝试使用反斜杠“\”

<arg line="-classpath C:\WTK2.5.2\lib\midpapi21.jar"/>