Blackberry Blog

Programming the BlackBerry With J2ME

New article which covers the creation of a BlackBerry J2ME application using the BlackBerry JDE was recently posted to Sun's Developer site. I'm more of an Eclipse guy (I'm not sure what the thinking is behind making developers use your development environment, I guess it's a 'make it easy for the corporate guys who can't code unless it's handed to them on a silver platter' kind of thing).

May 16, 2005 in Code by ajohnson


There are two big benefits to using RIM's JDE. One is on eclipse you have no emulator to debug the blackberry on and the Blackberry has some very specific quirks that you will not see if you build in eclipse or JBuilder using straight J2ME. Especially for corporate work where you have to simulate talking to the BES. You simply can't do it from Eclipse or JBuilder with any reliability. The first app I wrote for the BB's I wrote in JBuilder and then tested it on the Blackberry. It added about a week and a half of debugging that would have been uneccesary had I used the RIM's JDE first.

The second is using Eclipse or JBuilder they fully support J2ME and the Blackberries don't so there are a bunch of parts of J2ME that will build just fine in Eclipse or JBuilder but then won't run at all on a BB.

Now I work the other direction I build in RIM's JDE and then when I go to put it on other phones that have an emulator for JBuilder or Eclipse I test in that last because I get better results that way and I spend less time debugging.

My biggest complaints about RIM's JDE are that the profiler sucks and it has no good refactoring ability.

I think the logic for them providing their own JDE was that nobody could get stuff to run on the BB using pure J2ME when they built first in other environments. Also the BB has it's own API that is a form of J2ME but it's Blackberry specific so it won't build in other environments without a ton of hacking on your environment and even then it's scketchy. I don't use that API because you can't mix and match it with regular J2ME but most people developing on, the BB only, use it because they don't have to worry about their stuff running on other phones.

J2ME is so limited anyway it's almost painful to work in but on the BB's with four digit codes like 7510 etc. they have no C or C++ API so you are stuck with one of two things the BB proprietary API or the BB scaled down version of J2ME. So long as you have to work with crippled API's you might as well make it easy on yourself and use RIM's JDE. It will speed up your time to production and save you a lot of porting headaches if you work that direction vice working the other way.

Posted by: Andy on May 21, 2005 2:28 PM

Thanks, I was just considering building in eclipse. I guess I'll skip it :-)


Posted by: cameron on June 2, 2005 8:06 AM

Hopefully the JDE will include or use NetBeans in the future.

Posted by: Mike on June 11, 2005 4:01 AM

I personally find the RIM JDE a step backwards for development. So therefore I usually do the bulk of my development in Eclipse and jump over to the RIM JDE for debugging purposes.

A directory structure like so works nicely:
|-> src: all source code goes here
|-> rimjde: JDE workspace and project files

The JDE will automagically use relative paths when you add the source files under src to the project. Having a seperate dir for JDE workspace and project files will cause the rapc compiler to put that mess of .debug and .cod files in there. That will keep your Eclipse project dir tiddy.

Posted by: Josh on July 14, 2005 9:29 PM

You can bypass all that horrible JDE pain and suffering by using the JDWP Server that comes with the JDE. Essentially it allows any debugger that supports JDWP (such as Eclipse) to debug code running on the Simulator.

Run 'JDWP' (which should have been installed with the JDE).

In Eclipse, from the 'debug...' dialog, add a new 'Remote Java Application' and run it - the simulator should start.

Open your .cob on the Blackberry and away you go.

The only thing that's slightly bugging me (no pun indented) is that sysout goes to the 'Output' tab in the JDWP Server, rather that the Eclipse Console, this is a pretty minor complaint, the rest of it works quite well.

Oh, and to build a .cob using Ant; use Antenna:

Essentially, you use Ant to create a Jar, Antenna to create a Jad then Antenna to invoke rapc.exe to convert the Jad to a .cob. Email me if you'd like the Ant script.


Posted by: Dan on November 26, 2005 7:18 AM

This ant task: can help to automate build process of BlackBerry applications from Eclipse IDE.

Posted by: Taras2 on January 16, 2006 8:18 AM

I saw a very detailed article (on the Blackberry site, I believe) that showed a step by step way to use Eclipse and run the Berry JDE. I am using the Berry IDE at the moment, just to get familiar but will move to Eclipse as soon as possible.
Have not checked but the simulator should be callable from Eclipse with the build.

Posted by: Simon2524 on January 27, 2006 9:05 AM

Post a comment


Email Address:



Security Code:

Remember info?