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.
- 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)
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.
- 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
- 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.
- 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
- 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.
- Start the BlackBerry simulator. Load the COD file from the deployed folder and you should be able to run the LWUITDemo in the simulator.