Compile And Sign Blackberry apps on a Mac With Maven!


It’s Friday night and I finally found the answer to the last part of my SignatureTool.jar problem. See this post here that I will shamelessly inline for the fear of losing it to a random blog crash or deletion. The wonderful developers at Rim have never developed on Linux or Mac before. So they use backslashes in their path references! In short the post to download the ClassEditor software to poke around and change the values in the constant pool. (Get ClassEditor here then continue with the rest of the instructions.)

extract it, and run it with the command:
java -jar ce.jar

Open two class files extracted earlier: q.class and ad.class. ClassEditor will look something like this:
screenshot-classeditor-0.png
ClassEditor with q.class and ad.class

Start with q.class and select the Constant Pool tab. In this file we need to change string constants containing just a single backslash character. There are actually two constants in the pool but the first is just a reference to the second. The string we want is at index 223.
screenshot-classeditor-1.png
String constant at index 223

By default ClassEditor starts in read only mode so click the bright green Modify Mode(Off) button in the top right. The fields in the details area are now editable. Simply change the forward slash to a backslash and click Modify. Click save and that’s it for q.class!
screenshot-classeditor-2.png
String constant 223 modified

Select ad.class on left and locate constant 117, again in the Constant Pool tab.
screenshot-classeditor-3.png
String constant at index 117

Change the value from \sigtool.set to /sigtool.set and click Modify. Click save and that’s it for ad.class.
screenshot-classeditor-4.png
String constant 117 modified
Repack SignatureTool.jar and test

To repack SignatureTool.jar just cd to the temporary directory where you extracted the jar and rejar the class files
cd ~/lib/RIM43/bin/tmp
jar -cmf META-INF/MANIFEST.MF ../SignatureTool.jar *

Go up one directory and remove the temp directory
cd ..
rm -rf tmp

To test that everything worked, just run the command
java -jar SignatureTool.jar

If should prompt you to locate a cod file. Just cancel this and click the Properties button in the main signature tool window. If you see a list of Registered Signers it worked!

I followed the above with my copy of the SignatureTool.jar from the 4.2.x JDE and it worked flawlessly. After patching the SignatureTool.jar I repackaged it with the signature.csk signature.db and signatuer.set files and deployed it to our internal repo. The plugin I was working on now works without problems. I wanna stay up and work on this a little longer. I think I’ll put this post up on Monday.

One thought on “Compile And Sign Blackberry apps on a Mac With Maven!

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