Sunday, January 10, 2010

Customize Your J2ME Emulator

Why do we need to customize J2ME emulator ?
As a J2ME mobile developer, you have to port application to different devices,  while the J2ME default emulator only provide 4 different profiles, which can not meet our needs, and also some platforms like BlackBerry, Nokia S60 etc, the J2ME emulator they provided are really slow to launch, which is really inconvenient. If you can customize the emulator to support the device you are porting, which will improve your developing productivity.

Where are the emulator device profiles located?
 For example, if you installed wireless toolkit 2.5 in c:\WTK25, then the device folder is:

The mobility package is included in the NetBeans 6.5 or later version, the wireless toolkit folder is like this:
C:\Program Files\NetBeans 6.x\mobility8\Java_ME_platform_SDK_x.x

Create a new emulator device profile
I like to choose Sun Wireless Toolkit 2.5, because its Qwerty Device emulator looks better.   For example, if I want to create a device for Black Berry 9000:
1.  Copy the entire folder of  “QwertyDevice” to a new folder, rename the new folder name to “BlackBerry9000”
2.  Go inside the folder, rename the Qwerty.properies file to

Enable the touch screen
The touch screen feature is disabled for J2ME default emulators. If you want to enable it, you need to modify the .properties file. In properties file, find following statement:


Change false to true will enable the touch screen.

Change the screen size
For example, for BlackBerry 9000, its screen size is 480x320, then go to .prperties file, update the following values:


    and ..

Please note that you need to make sure:
   screen.height >  screenPaintableRegion.height + screenPaintableRegion.y
   In the properties file, screenPaintableRegion.y=11, so the screen.height value is 332.

   If you don’t put the correct value, the emulator will throw exception once it is launched.

Make your customization available in NetBeans IDE
Once You finished the customization, you need to update your NetBeans IDE environment:
  1. Select Tools – Java Platform,  choose Sun wireless toolkit 2.5, click Refresh button
  2. You will see the device names  you added in the device folder

You can easily customize J2ME emulator by modifying the .properties file, even it is really simple, it can improve your productivity considerably.

Further steps
This article is only focused on Wireless Toolkit 2.5.x , Sun released the new wireless toolkit 3.0,  the device emulators are changed a lot. I need to do more investigation on 3.0 emulator in future..


  1. This is great information. Unfortunately, I have also already had to move on to WTK 3.0. Mostly because I need the OS X compatibility.

    The included emulators don't cover much ground, and I have not been able to figure out how to customize them. I'd be happy if I could just find a way to get a 320x240 screen size. It appears that there is some serious voodoo required just to get it to recognize an additional configuration.

  2. Hi, Brian,
    This article tells how to customize the simulator for Java ME SDK 3.0:

    I wrote another article for Java ME SDK 3.0 review, I found it has some issues integrating with NetBeans.

  3. Hi Steve,

    This helped me to create 5 different customized emulators. Not only for Blackberry but also for Nokia bigger screen devices.

    Thanks ...!!!

  4. Hi, VeejayC,

    You are welcome, I am really glad that this post is helpful to you.

  5. Hi steve
    I wanted to know how to change the functionality of the sun wtk emulator. where can I get its source code with docs. This is not for any commercial purpose , that means I don't want to pay Sun any money for it :-P


  6. Hi, mahendar,
    I am not sure sun release its wireless toolkit as open source, I would suggest try to download the NetBeans source code, you might be able to find the emulator package if you are lucky.

  7. Hi Steve,
    just wondering if there is something more to modify...
    If I modify what you suggest in your article I still have some troubles with skin of the Emulator...
    Can you please help me on this?

  8. Hi, Alex,
    Please note that this will only works for WTK 2.5.x, for javaME SDK3, it is quite different. could you tell me in details what kind of problem you have?
    what screen size you need?

  9. Hi Steve,

    I have to test my application jad for touch screen devices as on real device its comands are not visible and working.I have made the settings as you suggested.But still its working on key based events.I doubt if its working as touch screen emulator.
    Can you please help me?