Welcome!

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

Reply
Developer
Posts: 39
Registered: ‎04-09-2009
My Device: Not Specified

App needs to use external jar file in the simulator -- how?

Hi guys.  I have built new projects to simplify my problem as much as possible before presenting it here.

 

Using Eclipse 3.4.2 with BB plugin (all recent stuff).

 

I built a simple Hello World app called BBHello that ran fine by itself in the simulator, and on the actual BB.  I then created a new project called ClientLib in the same workspace.  This simple project has a class with a public method getMessage() that returns "foobar".  I exported the new project jar file as "eclibb.jar".  I added eclibb.jar to BBHello, to the Java Build Path via "Add External JARs".  I edited BBHello to call the getMessage() method that resides in my new external jar file.

 

It builds fine.  If I choose "Run as" Java application, I can run the main() method I put in ClientLib as a test.  Everything looks fine.

 

But when I "Run as" Blackberry Simulator, I get "Module 'eclibb' not found".  I have tried everything and failed.  I am rather desperate...

 

Any help is *much* appreciated.  --fd

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

Re: App needs to use external jar file in the simulator -- how?

BlackBerry (simulator and device) only run cods not jars.  However a cod is basically a packed up jar with all the compiled classes in it.  You can convert from a jar to a cod - well I believe you can, I've never done it myself, but if you search on this forum you will find posts from people who have and I think there is a KB article which tells you how to do it too.

 

So you need to get your eclibb.jar converted to a cod and put this in the simulator and device.

 

In fact, if you have compiled it as a project then it is likely that you have already created a cod file for it.  Have a look in the same directory that you found the jar and there is probably a cod there too.  You can just copy that into the Simulator directory. 

 

Hope this helps

Developer
Posts: 39
Registered: ‎04-09-2009
My Device: Not Specified

Re: App needs to use external jar file in the simulator -- how?

> You can convert from a jar to a cod - well I believe you can, I've never done it myself,

>but if you search on this forum you will find posts from people who have and I think

> there is a KB article which tells you how to do it too.

 

All I could find were discussions about how to do it using the RIM JDE, not Eclipse with BB plugin.

 

> In fact, if you have compiled it as a project then it is likely that you have already created a

> cod file for it.  Have a look in the same directory that you found the jar and there is probably

> a cod there too.

 

Well originally my jar was from a non-Blackberry project, but following your suggestions I

made a new "Blackberry project" and created a cod file.  My app now has this new project jar on its classpath.

 

> You can just copy that into the Simulator directory.

 

I put the new project cod file, and all the other eclibb.* files into

 

C:\Program Files\eclipse-jee-ganymede-SR2-win32_regular\eclipse\plugins\net.rim.eide.componentpack4.5.0_4.5.0.16\components\simulator\Java

 

where I saw other cod files.  Is that right?  I do have another simulator directory that I left alone:

 

C:\Program Files\Research In Motion\BlackBerry JDE 4.7.0\simulator\java

 

Now at runtime in the Simulator I do not get the "Module not found" message.  But I get "class com.xx.yy.Eclib not found".

 

It sounds like my cod is rather empty.  At this point I'm feeling like my cod *piece* is empty, in addition to my cod *file*.

 

Any suggestions (with the latter problem that is)?  Thanks Peter --fd

 

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

Re: App needs to use external jar file in the simulator -- how?

"my cod *piece* is empty" - Smiley Very Happy

 

Since I'm not an Eclipse user, I can't really comment on your build process.

 

Re searching, I forgot to mention that the tool that does the conversion is called rapc and you will have it with you plug-in, so search for "rapc cod jar" and you should get a few hits.  This one looks fairly useful:

 

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&thread.id=22240

 

There is a KB article about it too:

 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800901/How_To_-_Compi...