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

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. 

 

Please use plain text.
New Developer
shivam284
Posts: 100
Registered: ‎01-23-2012
My Carrier: Blackberry

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
Please use plain text.
Developer
simon_hain
Posts: 13,830
Registered: ‎07-29-2008
My Carrier: O2 Germany

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
Please use plain text.
Contributor
Cainer
Posts: 11
Registered: ‎08-28-2012
My Carrier: --

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."

Please use plain text.
Developer
simon_hain
Posts: 13,830
Registered: ‎07-29-2008
My Carrier: O2 Germany

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
Please use plain text.
New Developer
Anand04
Posts: 50
Registered: ‎06-05-2012
My Carrier: 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,

Please use plain text.
Contributor
Cainer
Posts: 11
Registered: ‎08-28-2012
My Carrier: --

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?

 


 

Please use plain text.
Developer
simon_hain
Posts: 13,830
Registered: ‎07-29-2008
My Carrier: O2 Germany

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
Please use plain text.
Contributor
Cainer
Posts: 11
Registered: ‎08-28-2012
My Carrier: --

Re: importing external JAR

[ Edited ]

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

 

 

Please use plain text.
New Developer
Anand04
Posts: 50
Registered: ‎06-05-2012
My Carrier: 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,

Please use plain text.