Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Include resources into the JAR
Include resources into the JAR [message #257627] Thu, 27 November 2008 01:38 Go to next message
Eclipse UserFriend
Originally posted by: news.s237965939.online.de

I'm working on a J2ME project (I asked in eclipse.tools.mtj too) but
this might be also relevant to this group:

In my application there are images to display in forms. I can load them
from disk on the emulator. I've also imported the image in the elipse
project 'res' package/folder. But how will it go into the jar file and
how do I refer to it from the sourcecode? Currently I'm doing

Image image = Image.createImage( "/myPictue.jpg" );
picAlert.setImage(image);

TIA,
Hans
Re: Include resources into the JAR [message #257631 is a reply to message #257627] Thu, 27 November 2008 04:43 Go to previous message
Eclipse UserFriend
Originally posted by: news.s237965939.online.de

Ok folks, I found the answer myself. This works for me:

InputStream is = Object.class.getResourceAsStream("/mypic.jpg");
Image image = Image.createImage( is );

Thanks for reading,
Hans
Previous Topic:Supressing some packages in the PackageSelectionDialog
Next Topic:Save Failed (due to NPE in BreakpointMarkerUpdater)
Goto Forum:
  


Current Time: Fri Apr 18 07:12:23 EDT 2025

Powered by FUDForum. Page generated in 0.04341 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top