Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jar and path

 
Rikard Qvarforth
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i have a application ho needs to bee shipped out soon and i construckted a jar and in that jar there is a folder with my pictures that my application needs, here is the problem. my application is a trayapp that uses a native method to display the icon pic in the tray, that method needs the absolute path to a xx.ico file.
How can i get that path ? is it possible or must i place my picture folder out side the jar in a nown place ? that is a solution i dont want ! please help thanks
//Rikard
 
Rikard Qvarforth
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
humm think i got it .. i create a tmp file out of the stored picture in jar and from that get the absolut path // Rikard
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One answer that I can think of is to pass the location of the .ico file to your native method. If your native code can read .zip/.jar files, then you can include the .ico file in your .jar and tell your native code to look there. Otherwise, you will have to either
a). package the .ico separately and include a .properties file to tell where the .ico is, or
b). Package the .ico file in the .jar file. The first time you go to use the resource, use Java's jar API to extract it from the .jar file and place it in a tempory location on the hard drive (you could specify this using a .properties setting, if you wised....) Then pass the location of that file to your native code and it should be able to find it.
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rikard Qvarforth:
humm think i got it .. i create a tmp file out of the stored picture in jar and from that get the absolut path // Rikard

Essentially, my thoughts exactly
 
Rikard Qvarforth
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
he he thanks for the reply some times it help just asking the question to your self stupid huh
it works fine now
//rille
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic