Fixing the preverifier build error for Mpowerplayer on Mac OS X

If you’re using the Mpowerlayer SDK for your J2ME development on Mac OS X, and you get the following ant build error:

  $ ant
Buildfile: build.xml

compile:

preverify:
[exec] Error preverifying class java.lang.Class
[exec] VERIFIER ERROR java/lang/Class.newInstance0()Ljava/lang/Object;:
[exec] Illegal type in constant pool
[exec] Result: 1

package:

BUILD SUCCESSFUL
Total time: 1 second

Then you can fix it by changing the following entry in your build.xml:

<property name="java.classes.jar"  value="/System/Library/Frameworks/JavaVM.framework/Classes/classes.jar" />

to

 <property name="java.classes.jar" value="/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Classes/classes.jar" />

The error seems to lie in the Java 1.5+ classes that are included in the original build.xml. The fix points the build file to the Java 1.4.2 classes that are also conveniently installed by default on Mac OS X.

|