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
New Developer
New Developer
Posts: 9
Registered: ‎11-01-2008
My Device: Not Specified

Static libraries with the JDE plug-in

I have not been able to figure out how to configure the JDE plug-in for Eclipse to use a static library (i.e. a jar file that  I compile against and include directly into the final application jar/cod).


This can easily be done in the standalone JDE by simply adding the jar file to the project.

 

I’ve have tried the following three approaches with the JDE plug-in for Eclipse:

 

  • Approach 1 – Add the library jar file to the project’s standard (Eclipse) build path
  • Result: This builds but the contents of the library jar do not get included in the final application jar/cod file. This is because rapc treats these libraries as "-imports".

 

  • Approach 2 - Add the library jar file to the [Files section of the .jdp project file
  • Result: The Eclipse compiler fails on this because the classes are no longer visible to it (not on the standard build path)

 

  • Approach 3 - Do both 1 and 2
  • Result: Rapc fails with a "duplicate definition" error because the library is listed as both an "-import" and as a file to process / compile

Please let me know if anyone has a solution!

 

 

If no solution exists I'd suggest to the plugin guys the approach taken by the Eclipse ME (now Eclipse MTJ) project. They use the "exported" setting in the "Build Path/Order and Export dialog" to configure how the complier does this. If a library (or even a project) is marked as "exported" then the contents of that library get included in the final jar of the project, otherwise it simply compiles against it. This solution has worked well (at least for me) in standard J2ME development.

 

 

BlackBerry Development Advisor
Posts: 15,140
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: Static libraries with the JDE plug-in

I have been able to reproduce this and have forwarded the issue on to our development team.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
BlackBerry Development Advisor
Posts: 15,140
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: Static libraries with the JDE plug-in

[ Edited ]

There is a work around for using this in the current beta release.

 

1. In your Eclipse workspace create a new BlackBerry Project (File > New > Other> BlackBerry > BlackBerry Project) named myLib (you can change the name).

2. Right-click on myLibin the workspace and go to Properties > BlackBerry Project Properties > Application (tab) and change the Project type drop-down to Library.

3. Close Eclipse.

4. Navigate to the myLibproject folder within the Eclipse workspace.

5. Copy your library.jar file to the src folder of this project (filename can vary).

6. Open the myLib.jdp project file from within the project folder into a text editor and add the following lines:

 

[Files

src\library.jar

]

 

between the lines ExcludeFromBuildAll=0 and HaveAlxImports=0


7. Open Eclipse to this workspace and run Project > Build Active BlackBerry Configuration, this will create a myLib.jar file in the myLib project directory.

8. Import the whole library project you have just created into your application’s workspace.  Deactivate your application project, build the BlackBerry Configuration for the library project.

9. Activate your application’s project and then add this library project, to the project’s application build path.

10.Build the BlackBerry Configuration for your application’s project.

Message Edited by MSohm on 01-09-2009 04:22 PM
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
New Developer
Posts: 151
Registered: ‎01-05-2010
My Device: dev alpha c (bb10)
My Carrier: www.rzr.online.fr
Developer
Posts: 588
Registered: ‎05-29-2009
My Device: 9100

Re: Static libraries with the JDE plug-in

Is this still the only solution for this issue? I mean, even in new Eclipse plugins...