MikeTeo.net

A Software Technologist's Blog (Wanna Email Me?)

LWUIT Demo on BlackBerry with Eclipse

February 22, 2009 By miketeo
 

LWUIT is a UI library that is bundled together with applications and helps content developers in creating compelling and consistent Java ME applications. LWUIT supports visual components and other UI goodies such as theming, transitions, animation and more.  I have managed to use Eclipse to recreate the LWUIT demo package and generate a COD file for running on a BlackBerry v4.6 simulator.

Software Needed

  • Sun Wireless Toolkit or Nokia Symbian S60 SDK
    The toolkits are needed for EclipseME to compile/generate the JAD/jar files
  • Eclipse (I’m using v3.4.1)
  • EclipseME
    Follow the steps in the link to install EclipseME. However, use this URL for the repository link instead: http://www.eclipseme.org/testversions/
  • BlackBerry JDE
    For me, I’m using version 4.6 in this blog post.

My work environment is a Windows Vista (x64) machine with JDK 1.6 update 12 (x86).
Install the phone toolkit, Eclipse, EclipseME, and BlackBerry JDE on to your machine. If this is your first time setting up EclipseME, follow this post to setup the EclipseME for your phone toolkit.

Steps

  1. Download my BB_LWUIT Eclipse Workspace. The BB_LWUIT J2ME midlet project contains the LWUITDemo that has been modified to get it working on BlackBerry.
    • In lwuit.jar, all M3G and Transition3D classes are removed
    • In all the LWUITDemo java source files, modify these files such that they no longer require M3G and Transition3D classes
    • The images and .res resources files are extracted from the original LWUITDemo.jar so that they can be re-generated into the new BB_LWUIT.jar
  2. To rebuild the new BB_LWUIT.jar, just right-click on the BB_LWUITDemo project on the package explorer and choose J2ME > Create Package. The BB_LWUITDemo.jar will be created in the deployed folder.
  3. Start a command DOS console. Change the current directory to the deployed folder. Type in the following command:
    c:\Program Files (x86)\Research In Motion\BlackBerry JDE 4.6.0\bin\rapc.exe” import=”C:\Program Files (x86)\Research In Motion\BlackBerry JDE 4.6.0\lib\net_rim_api.jar” codename=BB_LWUITDemo -midlet jad=BB_LWUITDemo.jad BB_LWUITDemo.jar
  4. When the above command finishes, you will find a bunch of files created in the deployed folder. The BB_LWUITDemo.cod file is the one that you are looking for.
  5. Start the BlackBerry simulator. Load the COD file from the deployed folder and you should be able to run the LWUITDemo in the simulator.

Enjoy!

Screenshots Gallery

Download all screenshots

Main MenuOcean Fish ThemeButtons TestTabs TestLayout TestsRendering TestsAnimationTransition TestsFonts TestDialog TestsScrolling Tests

  1. Shai Said,

    Nice work. Although we currently recommend people use the native BlackBerry port from
    https://lwuit-incubator.dev.java.net/ (contributed by Thorsten) to achieve this. It has several technical advantages on the actual device.

  2. miketeo Said,

    @Shai:
    Thanks for your feedback. I will look into native BlackBerry port from the LWUIT incubator site for more details. In addition, I have discovered an useful message thread by Thorsten on the use of his port at this URL: http://markmail.org/message/mu7224x6wpjun4ik

  3. Weidong Said,

    Thanks for the post and have few issue to the steps.
    1. It seems the downloaded workspace refers to absolute path to “Nokia Symbian S60 SDK”. Where to get it?
    2. Which version of “Sun Wireless Toolkit” should be used? It’s part of Java Me SDK 3.0 now. Should I use Java Me SDK 3.0 instead?

  4. Budi Said,

    Thanks a lot. I downloaded your sample project and build with netbeans 6.91. It works. After looking around with google. Your modified LWUIT works perfect in blackberry simulator.

  5. Mohammad Abu Hmead Said,

    When i tried to navigate to other form this error appeared
    An internal application error occurred: java.lang.IllegalStateException: UI engine
    accessed without holding the event lock

Add A Comment