• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

image is missing when jaring

 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i'm gradually improving the complexity of my application using ant

i started with a jframe that displays an icon, then added images to tabs in a tabbedPane and now i'm trying to display a background image in a panel

though apparently quite simple this is hard: i'm trying to achieve two goals - running and jaring using the img folder in the classpath and also trying to run and jar using the jared img folder in the classpath instead (the idea is mastering these aspects in order to later being able to reference any jar i need to my application, always using ant)

so i have the needed images inside a folder called img
i jared this folder getting an imgjar.jar

in my code i use the path to my images like this (though i tried numerous combinations, mostly because no image entered when i started using packages, but that will be matter for another topic ):

now i "turn off" the imgjar out from the classpath and try to run the application using just the img folder placed in the classpath - all works perfectly

but when, with the very same setup, i jar the application, the background image doesnt show up - and i wonder why



some relevant code:


my ant file:


can someone please help me sorting this out, please?
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
curiously enough:

when i "switch" the classpath - i.e. - i put the imgjar in the classpath and remove the img folder from the classpath i get the following result:
when running - the background image is the only one to enter
when i jar the application - the background image is the only one not to enter
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How is this question different from this one:
https://coderanch.com/t/469220/Ant-Maven-Other-Build-Tools/jaring-images-folder
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Peter Johnson wrote:How is this question different from this one:
https://coderanch.com/t/469220/Ant-Maven-Other-Build-Tools/jaring-images-folder


i'm sorry but they just dont relate (well, its about the same aplication ) : in this one i've a problem with an image display, while in the other topic i'm questioning concrete jaring with ant - no problems whatsoever with displaying images, just asking how to jar a file

dont you agree?
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in case someone is interested in this topic, i found a solution, using the trial and error path

below i give the running code, as the ant build file: all you have to to is getting some suitable images

NOTE: this code works as it is - i mean without the use of packages; i'll open another topic concerning this last case



 
reply
    Bookmark Topic Watch Topic
  • New Topic