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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
Comitic
Posts: 68
Registered: ‎02-05-2009
Accepted Solution

Eclipse 1.1 can I add external 3-d party JAR library?

I thought it would be finally possible to add 3-d party libraries to the project using the latest Eclipse plugin 1.1

 

I tried adding a library and the project build (just like with previous versions) but it does not run on the emaulator. I get IllegalArgument exception and it basically says that it can not find the module I am trying to use (class name) from the library.

 

Thanks!

Please use plain text.
Administrator
MSohm
Posts: 12,957
Registered: ‎07-09-2008
My Carrier: Bell

Re: Eclipse 1.1 can I add external 3-d party JAR library?

Can you clarify if you are using version 1.1.0 or 1.1.2?  This is supported in version 1.1.2.  Are you trying to add the JAR file to your BlackBerry project (package the JAR library within your application COD file) or are you trying to create a library project/COD file that is installed with your application COD file?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.
Developer
Comitic
Posts: 68
Registered: ‎02-05-2009

Re: Eclipse 1.1 can I add external 3-d party JAR library?

Oh, my mistake, sorry, I assumed it was 1.1 for some reason.

 

I am using

 

Version:  1.1.2.201003212304-12

 

I am trying to add a JAR file to be added to my COD file so that I can use the library APIs (I assume it's option 1 that you mentioned).

 

You are saying that this is possible, but all the ways I tried, I could not do it successfully. Can you please give me a short wlkthrough how to do it or point me to an online resource?

 

Thanks!

Please use plain text.
Administrator
MSohm
Posts: 12,957
Registered: ‎07-09-2008
My Carrier: Bell

Re: Eclipse 1.1 can I add external 3-d party JAR library?

Please try the following (from the docs included with the BlackBerry Java Plug-in for Eclipse).

 

Add a .jar file dependency

 

  1. In the Package Explorer view, right-click the project that you want to add a dependency to.
  2. Click Build Path > Configure Build Path .
  3. Click the Libraries tab. 
  4. Complete one of the following tasks:
  • Click Add JARS if the .jar file is in the current workspace. 
  • Click Add External JARS if the .jar file is not in the current workspace. 

  5.  Select the .jar file that you want this project to depend on. The .jar file must be generated by either a Java® application project or a BlackBerry® application project of the Library type.

  6. Click OK.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.
Developer
Comitic
Posts: 68
Registered: ‎02-05-2009

Re: Eclipse 1.1 can I add external 3-d party JAR library?

I tried to do just that and I get the behavior I described in my original post.

 

 


MSohm wrote:
The .jar file must be generated by either a Java® application project or a BlackBerry® application project of the Library type.

 

This might be the problem. What does that mean? I don't know how the JAR file was generated. I got it from 3-d party vendor.

 

I tried to run preverify on the jar resuilting in preverified jar file. I tried to use both the preverified one and the original with the exact same result.

 

Is there a way I can repackage the compiled classes "the right way"?

 

Thanks!

Please use plain text.
Administrator
MSohm
Posts: 12,957
Registered: ‎07-09-2008
My Carrier: Bell

Re: Eclipse 1.1 can I add external 3-d party JAR library?

It means you can use a JAR file from a BlackBerry Application project.  The JAR file must be from a BlackBerry Library project or created as a standard Java library.  There is no way to convert a JAR file (from a BlackBerry Application to a BlackBerry Library).  The developer who created the JAR file could verify this.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.
Developer
Comitic
Posts: 68
Registered: ‎02-05-2009

Re: Eclipse 1.1 can I add external 3-d party JAR library?

Ok, so here's the deal:

 

Adding non preverified JAR file to the project as external library gives me exception with "Verification errors"

 

Adding preverified JAR file to the project as external library gives me an exception with error that the "module not found"

 

BUT if I compile using bb-ant-tools, everything works wonderfully!

 

So I have no problem manually preverifying the JAR, but it does not work anyways?! The directions that you posted simply do not work. So I am asking again - are you sure this is the way I should be adding an external library to the project?

 

P.S. the preverified JAR vs. non preverified JAR is not important here, I just added it for completeness.

 

My problem is super simple:

using bb-and-tools everything compiles and runs great, using eclipse (and adding the external jar as you suggested) I get "module not found" when I try to run the application.

 

Please use plain text.
Administrator
MSohm
Posts: 12,957
Registered: ‎07-09-2008
My Carrier: Bell

Re: Eclipse 1.1 can I add external 3-d party JAR library?

Open the Java Build Path, then go to the Order and Export tab and export the third party jar by checking the checkbox in front the jar.   Rebuild and let me know if you still receive the "module not found" error.

 

This should be valid for a JAR file created outside of the BlackBerry Java Plug-in for Eclipse (not a BlackBerry Library Project).

 

If the JAR file was from another BlackBerry Library project you'll need to install the COD file for this library on the BlackBerry smartphone (simulator) before running your application.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.
Developer
Comitic
Posts: 68
Registered: ‎02-05-2009

Re: Eclipse 1.1 can I add external 3-d party JAR library?

Now THAT worked. Hallelujah!

Please use plain text.
Developer
raquibulbari
Posts: 137
Registered: ‎09-30-2009

Re: Eclipse 1.1 can I add external 3-d party JAR library?

 


MSohm wrote:

If the JAR file was from another BlackBerry Library project you'll need to install the COD file for this library on the BlackBerry smartphone (simulator) before running your application.


 

Hi MSohm, 

Can you tell me how can I distribute the library cod file with my application? So that end user can install everything from one jad link?

 

 

----------------------
Press like if you find a message helpful
---------
Please use plain text.