-
1. Accessing configuration files in JBoss 5.1
peterj Mar 28, 2011 2:44 PM (in response to komyg)The jboss.server.config.url property will give you the conf directory as a URL (file:///c:/Servers/jboss-5.1.0.GA/server/default/conf).
Alternately, the conf directory is in the classpath, so you could use ClassLoader.getResource() or getResourceAsStream to load it also.
-
2. Accessing configuration files in JBoss 5.1
komyg Mar 28, 2011 5:39 PM (in response to peterj)Hi, thank you for your answer.
I have used the jboss.server.conf property and it has returned me this: "file:/C:/Servers/jboss-5.1.0.GA/server/default/conf/", just as you said it would.
However, since I am opening a properties file using the code below, I am getting a FileNotFoundException because of the "file:/" at the beginning of the property string.
propertiesFile = new FileInputStream(path);
properties.load(propertiesFile);
Is there a way to retrieve this property without the "file:/", or is it better just trim the resulting String after it?
Thanks,
Felipe
-
3. Accessing configuration files in JBoss 5.1
peterj Mar 28, 2011 7:17 PM (in response to komyg)1 of 1 people found this helpfulTry this:
propertiesFile = new FileInputStream(new File(new URI(path)));
-
4. Accessing configuration files in JBoss 5.1
komyg Mar 29, 2011 9:14 AM (in response to peterj)Hi,
I've done as you suggested and everything worked fine.
Once again thank you for your help!
Felipe