Midlet Development: class file for java.lang.NoClassDefFoundError not found

I have been experimenting a little with writing a mobile application in Java. Most of the basics seem fairly easy, given my background in VB.Net and C#. Other things, however, are baffling, or just plain frustrating.

The version of Java I am using doesn’t support emumerated types, so I am using a nice little class I found on the web to emulate them. In my code there is a class like this:

class GxHorizontalAlignment extends UtilEnum {

private GxHorizontalAlignment(String name) {super( name, GxHorizontalAlignment.class );

public static GxHorizontalAlignment Left = new GxHorizontalAlignment("Left");
public static GxHorizontalAlignment Center = new GxHorizontalAlignment("Center");
public static GxHorizontalAlignment Right = new GxHorizontalAlignment("Right");


I have been battling for a few days with an error in an error in”GxHorizontalAlignment.class” which reads:

class file for java.lang.NoClassDefFoundError not found
super( name, GxHorizontalAlignment.class );
^1 error

Switching from CLDC-1.0 to CLDC-1.1 makes the error go away.

SDN Bug ID 4313429 seems to explain things somewhat. However, without a proper work-around I will either be forced to target only CLDC 1.1 devices, or abandon this method of simulating enums.


5 Responses to Midlet Development: class file for java.lang.NoClassDefFoundError not found

  1. jocuri says:


    I found this error when Ive try to install a java game on my pocketpc, do you know how to fix it for this type of device?
    Thank you

  2. kramii says:


    I am sorry, I have no idea. My guess is that the game is simply incompatible with the version of Java that you have installed on your device. Perhaps you could contact the game’s vendor for help?

  3. Poorna Udupi says:

    Thanks for the blog post. I just looked up for the error string and got to this link..


  4. Abdu Ali says:

    I need a virus scaner

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: