Sun WTK Preverify failing in J2ME- java/lang/NoClassDefFoundError
-
14-06-2021 - |
Pergunta
I have written ANT script to preverify the classes.,
<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>
When the above script executes, it is not able to find the midp classes in the classpath, so it's showing the error,
[exec] Error preverifying class first.MCCanvas
[exec] java/lang/NoClassDefFoundError: javax/microedition/lcdui/Canvas
[exec] Result: 1
But the required libraries are in the classpath, Please note compilation is fine for the MIDlet and Canvas classes!
Solução
Try with backslashes "\"
<arg line="-classpath C:\WTK2.5.2\lib\midpapi21.jar"/>
Outras dicas
Why don't you use Antenna? http://antenna.sourceforge.net/
Your build script would use:
<wtkpreverify cldc="CLDC-1.0" srcdir="${build}/classes" destdir="${build}/preverified" classpath="${wtk.home}/lib/cldcapi11.jar;${wtk.home}/lib/midpapi20.jar" />
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow