我已经编写了 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 类的编译很好!