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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
New Developer
Posts: 10
Registered: ‎08-29-2011
My Device: 8350i
My Carrier: Nextel

Image not included in .JAR

[ Edited ]

Hi,

 

I have a trouble with an image resource and I think is so easy to fix but I just cant get the answer so far.

 

I'm trying to load an image using Bitmap.getBitmapResource("logo.png"). The problem is that is not working. I have checked the .jar file and the images are not there so obviously that is the matter. I just don't know how to make the eclipse to load the files into the jar file. 

Just for the record:

* The files are directly in src folder.

* I have tried all the path combinations

* I have deleted and re-imported the images

* i have changed the SDK from 4.6.0 to 4.6.1

* I have recreated the project.

 

Nothing works!!!! . the .JAR file doesnt have the images inside,

 

Any clues?

 

Regards,

Marco

 

 ///:::::::::::::::::::::::::::::

 A situation I just discovered is that if I use JRE 5.0, the same code, the same directory structure, it works fine. So the problem is with JRE 4.6 and 4.6.1. Somebody with the same problem?

 

 

 

Developer
Posts: 638
Registered: ‎07-02-2009
My Device: Not Specified

Re: Image not included in .JAR

create a new folder 'images' with in src folder and try to access from there.

Thanks and Regards,
PraveenGoparaju.
Highlighted
Contributor
Posts: 37
Registered: ‎07-26-2011
My Device: Non Blackberry User
My Carrier: Non Blackberry User

Re: Image not included in .JAR

[ Edited ]

create new folder "res" if it's not there along with src folder & move your all images to this folder.

 

check the property of project:

 

  1. right click on project in project explorer
  2. go to properties
  3. select java build path
  4. check in order & export tab, your res folder should be included there, i.e. it should be checkhed.

check in your code that  "/" (slash) is added before your image name in create Image method eg 

Bitmap.getBitmapResource("/logo.png")

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Please press the kudos button (star icon) on the left side to thank the user that helped you.
2. Please mark posts as solved if you found a solution.
- Paresh Indulkar
(Game Programmer at Synqua Games)
(Developer of games - BBM Cricket with Friends & Word Poker with Friends Smiley Very Happy )
New Developer
Posts: 10
Registered: ‎08-29-2011
My Device: 8350i
My Carrier: Nextel

Re: Image not included in .JAR

Thanks to both of you, I tried both solutions, nothing works.

 

It is strange cause the only image that actually is inside the jar file is the app icon, so if I use

 

Bitmap imgHeader = Bitmap.getBitmapResource("/icon.png");    instead of logo.png it works.

 

Any other advice?

 

Regards

New Developer
Posts: 10
Registered: ‎08-29-2011
My Device: 8350i
My Carrier: Nextel

Re: Image not included in .JAR

Thanks to both of you, I tried both solutions, nothing works.

It is strange cause the only image that actually is inside the jar file is the app icon, so if I use

Bitmap imgHeader = Bitmap.getBitmapResource("/icon.png"); instead of logo.png it works.

Any other advice?

Regards
New Contributor
Posts: 2
Registered: ‎08-22-2011
My Device: Curve 8520
My Carrier: Developer

Re: Image not included in .JAR

I have a solution that perharps is not too good but here we go. I had the same problem doing this from eclipse so i replace the file rapc.exe and rapc.jar in C:\Program Files (x86)\Research In Motion\BlackBerry JDE 4.6.1\bin with the files in my eclipse component 5.0 in my case C:\EclipseBlackberryJava\plugins\net.rim.ejde.componentpack5.0.0_5.0.0.36\components\bin. And it worked, I'd check my jar file and there were the images.

 

So simply do this rename rapc.exe and rapc.jar from JDE 4.6.1 to rapc.exe.old and rapx.jar.old just in case don't work and copy  rapc.exe and rapc.jar from net.rim.ejde.componentpack5.0.0_5.0.0.36\components\bin folder in eclipse and paste them in C:\Program Files (x86)\Research In Motion\BlackBerry JDE 4.6.1\bin or whatever is your bin of bb jde 4.6.1 .

 

Let me know if someone else got this work like that too.

New Developer
Posts: 2
Registered: ‎09-06-2010
My Device: Curve
My Carrier: Airtel

Re: Image not included in .JAR

This really worked even with component pack 6. Thanks a ton gbonilla!