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
cersalma
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?

 

 

 

Please use plain text.
Developer
Blanc
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.
Please use plain text.
Contributor
Pri-Machine
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 :smileyvery-happy: )
Please use plain text.
New Developer
cersalma
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

Please use plain text.
New Developer
cersalma
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
Please use plain text.
New Contributor
gbonilla
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.

Please use plain text.
New Developer
nand_kv
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!

 

Please use plain text.