My solution is just using NetBeans and BlackBerry JDE, it is much easier to build a demo.
Here is the step by step description:
Build LWUIT BlackBerry library
1. Checkout the LWUIT source code from SVN, (https://lwuit.dev.java.net/svn/lwuit/trunk), the LWUIT source includes the NetBeans BlackBerry port project.
2. Install JDE 4.7 and Configure BlackBerry support in NetBeans, you can follow this link to configure;
3. Start NetBeans, open the "BlackBerryPort" poject under the "BlackBerry" sub folder of lwuit project source, there are two configuration for this project, the default is for non touch screen build, the "touch" configuration is for touch screen device like STORM.for non touch device, just choose DefaultConfiguration, build the project, you will see BlackberryPort.jad and BlackberryPort.jar in \dist folder, they are the LWUIT library for BlackBerry devices;
Build LWUIT Demo into BlackBerry CLDC application
1. Open Blackberry JDE, create a new workspace, called "lwuitdemo.jdw";
2. add a new project under the workspace, name it "lwuit", choose its Application type as "Library", import the BlackberryPort.jad and BlackBerryPort.jar file into the project. then build it, the JDE will generate lwuit.cod and update BlackBerryPort.jad file.
3. download LWUIT 1.3 from sun website, it comes with the famous LWUITDemo source code, open the LWUITDemo project using NetBeans, build it;
4. add another new project in the JDE workspace, name it "lwuitdemo", choose application type as "CLDC Application";
set up the correct value with title, version and Vendor information;
next you need to add project dependency to "lwuit" project, right click project, choose "Project Dependencies..", choose "lwuit project";
copy all the java source code from LWUITDemo src folder, add them into the project, ignore those png files and .res files;
go to build\preverified folder, copy all the png files and .res files, add them into your JDE project;
right click icon.png, choose "use as application icon";
5.Modify the UIDemoMIDlet.java
Made following changes:
make sure the UIDemoMIDlet extends from uiApplication, like this:
public class UIDemoMIDlet extends net.rim.device.api.ui.UiApplication {...}Add the following methods, copied from Shai's blog:
public static void main(String[] argv) { new UIDemoMIDlet().startApp(); } public void notifyDestroyed() { System.exit(0); } public void platformRequest(String s) { net.rim.blackberry.api.browser.Browser.getDefaultSession().displayPage(s); }In startApp() method, comment out the following statement, because non touch device need to disable the virtual keypad:
// VKBImplementationFactory.init();6. Build the lwuitdemo project.
7. Sign both lwuitdemo.cod and lwuit.cod fle, load them both into your blackberry device.
8. If you want to provide OTA download, that is a litttle bit tricky:
You need to download two artifacts, one for lwuit libray, the other for lwuitdemo, which means user need to download two links:
1) lwuti library:
BlackBerryPort.jad
lwuit.cod
lwuit-1.cod
...
2) lwuitdemo application:
lwuitdemo.jad
lwuitdemo.cod
lwuitdemo-1.cod
...
You can download the whole source code of the JDE project from here.
In future I would like to share:
1. Provide an updated build.xml based on Shai's blog;
2. provide how to build LWUITDemo MIDlet project for BlackBerry device.
Hi Steve, This is really helpful,Thanks,
ReplyDeleteeverything compiles successfully, just have a problem when running the app, im using the blackberry 9500 Simulator with the JDE 4.7, i get the "error in constructor" Exception, i assume there is no compatibility issues? also, i have not changed my build.xml at all..
please help
Regards,
Ryan
Hi Steve...
ReplyDeleteI'm trying to port my JME LWUIT application to BB, and I was using your article.
However I'm running into some problems. I tried to download the source code of the JDE project, however the resource is not reachable.
Can you provide an updated link please?
Thank you anyway for these articles regarding BB port of LWUIT.
Tiago Clemente
Hi, CastSpellar,
ReplyDeleteI attached the source code in my email to you. Please let me know if you still have issues.
Hi, Ryan,
ReplyDeleteCould you attach your source code? Or can you build my code successfully in your computer?
If you don't mind, you can send me email with your code.
Hi Steve,
ReplyDelete"You can download the whole source code of the JDE project from here."
This link is no longer working, can u please update and share the new project folder.
Hi, Shankar,
ReplyDeleteThanks for your remind, I just change the share setting, now it should be OK.
Thanks Shankar to share this article with us. M also working with Blackberry Application Development, so this is very helpful to me.
ReplyDeleteHi, Ryan,
ReplyDeleteI remembered that this project is for blackberry non-touch device build, if you want to use in 4.7, you need to use the different jad and jar file of lwuit blackberry port
This comment has been removed by the author.
ReplyDeleteHi, I managed to get my LWUIT midlet workign on the BB emulator using parts of this technique you describe - unfortunately I found your instructiosn to be out of date (there is no Blackberry port project in the lwuit source for example, Im presuming its now called UI_RIM?).. Anyway it runs and works but when I try to go back for instance I presume I need to use the BB menu key? However when I press this key a menu does appear but it is empty, nothing in it at all. Im assuming in here I should see the softkey equivalents from the j2me version? but nothing, if I select the menu I get a null pointer. Any tips about how to populate this menu or what my problem might be would be greatly appreciated. Thanks very much for your useful guide!!
ReplyDeleteHi, Gaz,
ReplyDeletethis post is almost a year old, I just noticed that the latest version of LWUIT project has changed, you are right, they use UI_RIM instead.
I would suggest use NetBeans IDE to build the blackberry application.
I just browse the the UI_RIM, they use Blackberry native menuItem API, it should be no problem. For your case could you send me your source code, so that I can point out the issue.
Hi, I have built my midlet for Blackberry Storm, and it runs on the emulator - but I cant touch things to select them, on the emulator im still having to use the cursor keys to move around and enter to select things - how do I get it so I can simply touch something and it will select? Do I need to turn on touch somehow? Thanks!
ReplyDeletemy app is working fi9, bt it shows default app icon and midlet name instead of app icon and application name? please help me?
ReplyDeleteHi Steve,
ReplyDeleteHi,
I have blackberry 8700, and i installed spy cell phone software on my blackberry, but when i use to run the application, it gives an error saying "java.lang.NoClassDefFoundError"
Can any one help how to get rid of this error?
Thanks
Rizwan