04-19-2010 05:49 PM
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!
Solved! Go to Solution.
04-23-2010 01:51 PM
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?
04-23-2010 03:18 PM
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!
04-23-2010 03:53 PM
Please try the following (from the docs included with the BlackBerry Java Plug-in for Eclipse).
Add a .jar file dependency
- 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.
04-24-2010 03:35 PM
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!
04-26-2010 01:34 PM
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.
04-26-2010 01:57 PM
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.
04-26-2010 02:36 PM
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.
04-26-2010 04:36 PM
Now THAT worked. Hallelujah!
05-15-2010 12:58 AM
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?