I have a jar called App.jar and it's structure is as follows
App.jar
|
|
|---xyzfolder
| |
| |--config
| |
| |--config.properties
|
|
|---com (contains classes)
|
|--MyClass.class
Now what I want is that I want to access config.properties file from MyClass.class
Have you tried the following?
this.getClass().getClassLoader().getResourceAsStream("classpath:/xyzfolder/config/config.properties");
see http://download.oracle.com/javase/1.5.0/docs/api/java/lang/ClassLoader.html#getSystemResourceAsStream%28java.lang.String%29
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With