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
Contributor
Cainer
Posts: 11
Registered: ‎08-28-2012
My Device: 9800

importing external JAR

[ Edited ]

hello,

I am working with BlackBerry plugin for Eclipse and I need to import external Jar to my app. I followed some instructions I found -- preverified jar and imported it as referenced library. So now I have this

 

 

Now ... how can I import classes from this jar in my app? If I try

import my_lib.*;

 it doesn't find anything. 

 

Thanks for any help. 

 

New Developer
shivam284
Posts: 108
Registered: ‎01-23-2012
My Device: torch,bold,curve,strom

Re: importing external JAR

Hi ,

 just go to your build path of the project and configure your build path in that configuration just add the external jar in to the library and  export the jar.

 

Hope it will work!

Thanks & Regards,
Kumar Shivam
Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: importing external JAR

welcome to the support forum.

how do you come up with "insert"?
the proper statement should be "import", and you should use the full package name used inside the library.

e.g.
import com.isec7.handheld.ui.ColorLabelField;
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Contributor
Cainer
Posts: 11
Registered: ‎08-28-2012
My Device: 9800

Re: importing external JAR

shivam284: Yes, I have already done that. Now I need to use classes from the Jar.

simon_hain: Sorry for the "insert", of course there should be import. But still, "the import my_lib cannot be resolved."

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: importing external JAR

use the full package name.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Anand04
Posts: 95
Registered: ‎06-05-2012
My Device: Developer

Re: importing external JAR

jar expand

 

expand jar file, then use package name which you declaired in jar like in above example "net.rim.blackberry.api.bbm.platform" is package in jar.

 

for import classes and interface inside the package use:

 

import net.rim.blackberry.api.bbm.platform.*;

 

 

thanks,

Contributor
Cainer
Posts: 11
Registered: ‎08-28-2012
My Device: 9800

Re: importing external JAR

[ Edited ]

Thanks for replies. But the problem is ... classes are generated by Cibyl and they are not part of any package (they are in "default package"). Does it mean I can't use them?

 


 

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: importing external JAR

if its in the default package you should be able to use
import Cibyl;
etc
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Contributor
Cainer
Posts: 11
Registered: ‎08-28-2012
My Device: 9800

Re: importing external JAR

[ Edited ]

I can't :smileysad: If I try to import any class, it says "Symbol cannot be resolved". 

 

 

Developer
Anand04
Posts: 95
Registered: ‎06-05-2012
My Device: Developer

Re: importing external JAR

[ Edited ]

Hi Cainer,

 

i think you are using like import Cibyl;

if you want to import Cibyl class use syntax:  import Cibyl.java;

 

 

thanks,