java - Eclipse: Working with Systemresources -


based on feedback url load resources classpath in java have changed project, include image resources images.jar

my project setup now

/program.jar /images.jar 

in code load images using

inputstream connectedimage = classloader.getsystemresourceasstream("images/logo.png"); 

my eclipse setup is

/src/... /images/logo.png 

my problem

eclipse cannot find systemresource based on url. in order work, have

  1. manually create images.jar containing image folder
  2. add images.jar file eclipse project

what need

  1. how can configure eclipse can use same code load image either images.jar (if run commandprompt) or images folder(if run eclipse)?

  2. is there way make eclipse include /images/ folder when creating runnable jar file of program? not include besides refereced jar files , source code.

this do:

  1. set directory source folder: right click -> build path -> use source folder
  2. change structure of images.jar image files on root (not under directory)
  3. change code to:

    inputstream connectedimage =      classloader.getsystemresourceasstream("logo.png"); 

update: 1, can export images on same jar classes


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -