Skip navigation

Category Archives: java

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" />

This was the solution which i got after researching for quite sometime. However, this might have fixed issue for some, i was still facing the same issue.. :(

So after debugging for some more time, realized that
/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2 was a symlink to the current jdk

dv-mac-anooj-n:Versions anooj$ ls -l
total 64
lrwxr-xr-x 1 root wheel 5 Jun 26 21:09 1.3 -> 1.3.1
drwxr-xr-x 3 root wheel 102 Jul 21 2009 1.3.1
lrwxr-xr-x 1 root wheel 10 Jun 26 21:09 1.4 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Jun 26 21:09 1.4.2 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Jun 26 21:09 1.5 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Jun 26 21:09 1.5.0 -> CurrentJDK
lrwxr-xr-x 1 root wheel 5 Jun 26 21:09 1.6 -> 1.6.0
drwxr-xr-x 8 root wheel 272 Jun 26 21:11 1.6.0
drwxr-xr-x 9 root wheel 306 Jun 26 21:11 A
lrwxr-xr-x 1 root wheel 1 Jun 26 21:09 Current -> A
lrwxr-xr-x 1 root wheel 3 Jun 26 21:09 CurrentJDK -> 1.6

So now i just had to remove the symlink :

sudo rm 1.4.2

and paste 1.4.2 version folder here.. Issue resolved.

PS: i got 1.4.2 from my colleagues lappy.. Donno if apple allows you to download it.

If you want a fixed size list, wherein you don’t want to add/remove elements into it then probably this trick will save some line of code:

Consider this:

List<Character> vowels = new ArrayList<Character>();
vowels.add('a');
vowels.add('e');
vowels.add('i');
vowels.add('o');
vowels.add('u');


This could have also be written as:


 List<Character> vowels = Arrays.asList('a', 'e', 'i', 'o', 'u');

Trying to add/remove elements from this list will result in an UnsupportedOperationException exception