aspose file tools*
The moose likes Java in General and the fly likes jar and path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "jar and path" Watch "jar and path" New topic
Author

jar and path

Rikard Qvarforth
Ranch Hand

Joined: Jul 10, 2001
Posts: 107
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

Joined: Jul 10, 2001
Posts: 107
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

Joined: Aug 20, 2001
Posts: 1817

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.


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1817

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

Joined: Jul 10, 2001
Posts: 107
he he thanks for the reply some times it help just asking the question to your self stupid huh
it works fine now
//rille
 
Don't get me started about those stupid light bulbs.
 
subject: jar and path