Hi,
how can I find a .properties file from a class deployed in a jar/war/ear without coding any absolute path informations into the source? Note that the class in question does not have to be an EJB, but will be loaded/used/referenced by one...
Thanks,
Lars
-
How to find .properties file? (1 messages)
- Posted by: L Stitz
- Posted on: June 05 2002 03:05 EDT
Threaded Messages (1)
- How to find .properties file? by Travis Kay on June 05 2002 07:55 EDT
-
How to find .properties file?[ Go to top ]
- Posted by: Travis Kay
- Posted on: June 05 2002 07:55 EDT
- in response to L Stitz
You can use your classes ClassLoader to find your property files.
Properties p = new Properties();
InputStream in = yourclass.getClassLoader().getResourceAsStream("my.properties");
//If the resource is not found , null is returned.
if( in != null)
p.load(in);
xxx...
If you don't want to 'hard code' the properties file name,
set it up as an environment entry the respective deployment descriptor.
TK.