| Author |
Reading properties file in jar META-INF
|
Rusty Enisin
Ranch Hand
Joined: May 26, 2005
Posts: 107
|
|
I have a jar file that has different configurations depending on which stage of development it is in. The build puts the right info in the jar in a properties file. I am having a hard time accessing the properties file if I put it anywhere else other that right next to the class that is using it. I would like to put the properties file in the META-INF dir of the jar file. Here is the code from a method in a class in the jar. This works if the properties file is next to the class: I have tried "/system.properties" and "/META-INF/system.properties" but they did not work. Absolute paths work. But our production machines have different paths. How do I access the properties file in META-INF?
|
The squeaky wheel gets the grease. Well, that or replaced...
|
 |
Jaikiran Pai
Marshal
Joined: Jul 20, 2005
Posts: 8146
|
|
Try this:
|
[My Blog] [JavaRanch Journal]
|
 |
Rusty Enisin
Ranch Hand
Joined: May 26, 2005
Posts: 107
|
|
|
That did it. Thanks, Jaikiran!
|
 |
matias Yaryura
Greenhorn
Joined: Sep 15, 2008
Posts: 18
|
|
|
Perfect !! it's very useful!!
|
 |
 |
|
|
subject: Reading properties file in jar META-INF
|
|
|