antjava-memidpjava-wireless-toolkit

Sun WTK Preverify failing in J2ME- java/lang/NoClassDefFoundError


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!


Solution

  • Try with backslashes "\"

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