Tuesday, September 15, 2009

J2ME - Setting Eclipse to use CLDC 1.1

If you had followed my last post to setup eclipse to use J2ME SDK 3.0, you will slowly find out that you could not use Float. This is because CLDC 1.0 does not support floating precision.

If you look closely, you will find that Java Wireless Toolkit 2.5.2 support CLDC 1.1 and MIDP 2.1. Then how could J2ME SDK 3.0, a better version of JWT 2.5.2, does not support that.

The problem is when you configure Device Management at Eclipse, it includes both CLDC 1.0 and CLDC 1.1 jar. If this happen, Eclipse will use the lower version. To fix this, do the following

1. Go to Window -> Preferences Menu
2. Under J2ME -> Device Management.
3. You will find the configuration and profile is 1.0 and 2.0 for most device.
4. Select a device, ie DefaultCldcPhone2, click on Edit button.
5. Click on libraries tab, you should see a list of libraries that this device is referred to.
6. Now, find and remove cldc_1.0.jar and midp_2.0.jar entry. Also, make sure cldc_1.1.jar and midp_2.1.jar exists.
7. Save all changes and you will eventually back to the Device Management page.
8. Now, you should see the configuration and profile is 1.1 and 2.1 for the modified device. If you see that, you are ready to use float.


  1. You saved my life man!!


  2. It is great that this post help you :)

  3. Great tip man!

    I'm using Random.nextInt(int), and this method is only in CLDC 1.1.
    I didn't know how to change the Configuration in Eclipse.

    Thanks a lot!

  4. Thank you for this post! It is very helpful)