This content has been marked as final.
Show 3 replies
-
1. Re: reading a local properties file
peterj Feb 1, 2008 1:35 PM (in response to gryffin)You should really place the properties file at WEB-INF/classes, then it should be easy to locate using Class.getResource() or ClassLoader.getResource() [simply supply the file name].
-
2. Re: reading a local properties file
gryffin Feb 1, 2008 2:17 PM (in response to gryffin)Well, thank you Peter. Durn if that wasn't wasn't easy once it was explicitly laid out. I'd preferred to keep only classes in the classes directory, but I didn't see any working examples of this so I was stymied.
Thanks again, Peter. -
3. Re: reading a local properties file
oskar.carlstedt Feb 3, 2008 4:06 PM (in response to gryffin)Hello!
This is the way to go. Never add a properties-file in the WEB-INF folder. A better place is on the classpath, i.e. in the WEB-INF/classes directory. Then you can access this file with the following command:Thread.currentThread().getContextClassloader().getResourceAsStream("filename.extension");
Cheers
/Oskar