Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Posts: 26
Registered: ‎08-04-2008
My Device: Not Specified

Blackberry Application don't show library during install.



I am a newbie in blackberry application development.


I have developed a  common library application in JDE 4.0.2 for the basic functionalities of my application.


I have included the library application as imported jar file / dependent project in my GUI application.


But at the time of installtion i need to add the .cod files of the Library application too for the successful working..


So there is 2 .cod files associated with one application.


I can avoid the same by adding the source files of my library application in GUI application.


But i am planning to use the same library application in different GUI applications and i don't want to add the source code with the GUI application.


My requirement is to develop a GUI application with the help of the library applications jar file.


Also i need a single .cod file for the installation.


How can it possible with the help of JDE 4.0.2?


Thanks in advance



Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Blackberry Application don't show library during install.

What you are trying to do is partially possible, in fact I think it is a good way of doing it.


To link your GUI application with the Library, use the "Imported jar files" input area on the Build Tab of your Project's Properties.


However as a result of doing this you will have TWO cods to install.  But, I've not found multiple cods for an application to be a problem - just list them all in the alx or jad.


I will mention 2 things:

a) When  working on your GUI application, the simulator might not have the correct/current version of the Library cod because 'Build and Run' will not put the Library cod into the Emulator directory

b) I would have a 'production' place for your Library Jar, and use this location in your Build "Imported jar files".  Each time you change the jar at this location, the JDE will force you to recompile your application.  So I would create a production version and stick with it.  In fact, you can have a later level Library on the device/emulator, and, as long as the methods used by the GUI application still exist in the Library, your GUI application will run.  This means you can update your Library and GUI independently.


One final point, I have problems with the 4.02 JDE, I would recommend going to 4.1.  In the UK, as far as I know, the only devices you 'miss' with 4.1 verses 4.0.2 are a few 7290's.  However, I think in the US, 4.0.2 was originally for 7520 (?) a GPS enabled device, so you might miss a few more devices.

Posts: 191
Registered: ‎04-03-2008
My Device: Bold 9700

Re: Blackberry Application don't show library during install.

I've done this and, unless I did something wrong (not impossible Smiley Happy, I ran into the following problem: I couldn't install two apps on the same device if they shared the same library ("shared" meaning that they each referenced the same library in their jad file).  For example:



  `-- LibraryA



  `-- LibraryA


  Installing App1 was fine, but when I would install App2 the device would tell me that it needed to uninstall App1 - can't remember the exact wording of the reason.  IOW, the BlackBerry wasn't treating the "shared" library as shared - it was seeing the library as a new module that needed to be installed on top of the previous library, which also caused the previous app to be removed.  Sorry if this is vague, but before you invest too much into this I'd recommend trying it out first in case there's an issue like this.

Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Blackberry Application don't show library during install.

[ Edited ]

Richard, you are correct, and I should have pointed this out.  In my defense, I think that whether this is a problem or not depends on the level of OS, I think some (earlier?) levels of OS are (were?) smart enough to 'mark' the shared cod as required by two applications.  This is how I think it should work, i.e. the OS should allow a cod to be owned by multiple applications.  Perhaps we could petition RIM to let it work this way? 


In our case, we install the first application with the shared library, subsequent applications are installed without the library.  In fact I would prefer to install the first application in two parts, but this confuses most people....


I have had a discussion with a technical person from RIM regarding this and he suggested the following, which I have not tested.  Here is the comment.


A little-known "trick" that you can use with BlackBerry apps is that it they support multiple classloaders. Normally mobile java devices have a single classloader, which means that every fully-qualified class name must be unique across the entire device JVM. With the BlackBerry JVM, you can have the same fully-qualified class name as long as they are in separate cod files.


So for you application if you have a single library, you can import it into multiple projects so that each project (ie. application) is fully independent of other projects.


I haven't tested this out myself but it should work.


However the lack of multiple classloaders was bought up on the old forum, and an associated blog entry

(see http://www.blackberry.com/developers/forum/thread.jsp?forum=1&thread=8949 and http://theblackberrydeveloper.blogspot.com/2006/09/why-must-device-be-restarted-after.html) and the implication, though I don't think anyone from Rim actually said it, was that there was only one class loader. 


I did try renaming cods sometime ago (in OS 4.0) and it resulted in the BlackBerry barfing with duplicate class messages.  I stopped the test then, though of course, both applications might have worked!  I'm on holiday ATM, but I will try to run a test and let you know.


Message Edited by peter_strange on 08-06-2008 02:00 AM