How to get images in your cod for Blackberry


Such a painful problem it is to create Blackberry software from anything other than their proprietary JDE. There are options, however. There’s some blackberry Ant tools (an independent project and also there’s a few things in the Antenna project). Then there’s RIM’s rapc docs, which aren’t too informative. Finally there’s the post I made a while ago detailing some of the inner workings of rapc. In the post and also in the comments I hint at ways to get images and other resources into the final cod file. To save you the pain of reading there I’ll write about it here. Once you figure out how to compile with RAPC and at least get a working cod file, you need to compile again. The trick is to pickup the jar file that RAPC creates next to your cod and stick images and resources in there. Finally, remove some rapc generated .csi and .cso files before you pass the jar back to rapc. (If you forget to remove these files rapc will complain and list them in the error output, though you might not understand what it’s trying to tell you. Just know if you get an error recompiling jar and you see mention of a file ending in .cs-whatever that you’ll need to remove the file(s) in question.) Here’s some pseudo-code since I’m too lazy/busy/uncertain/tired/vitamin-B-deficient/loaded-with-excuses to post the real solution:

call rapc net_rim_api.jar -midlet -codename MyApp MyApp.jad @myJavafilesList.txt
updateJar MyApp.jar (use images/resources)
removeRapcFilesFromJar MyApp.jar
call rapc net_rim_api.jar -midlet -codename MyApp MyApp.jad MyApp.jar

4 Comments

  1. ab3ndq

    Thanks for the advice, this fixed all the problems I was having with RAPC and whitened my teeth overnight!

    Here’s how I did it in ant:

    ${srcfiles}

    The second pass didn’t gripe at me about the cs-whatchacallit file, so I didn’t add a step to remove it, but if I had, rapc_pass_2 would have depended on it.

  2. ab3ndq

    Humph. I think something filtered out all the ant code I put in.

  3. ab3ndq

    Harumph. Something ate all my ant code.

    • Dan

      Hey ab3ndq, can you post that code somewhere?

      Thanks,
      Danny

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 251 other followers

%d bloggers like this: