-
1. Re: Unable to load .properties file
fbiaggi Feb 8, 2005 12:58 PM (in response to monocongo)Hi,
try:
PropertyResourceBundle prs = new PropertyResourceBundle( Thread.currentThread( ).getContextClassLoader( ).getResourceAsStream( "my.properties" ) );
or add a / on the file name if it is on the files system (bin directory). -
2. Re: Unable to load .properties file
monocongo Feb 10, 2005 5:05 PM (in response to monocongo)Thanks so much, getting a PropertyResourceBundle as you describe works well. The initial slash in front of my properties file name didn't help. It seems that loading Properties isn't as straight-forward as it should/could be with JBoss. Can it even be done at all ? If so can someone post the code or the configuration required ?
--James -
3. Re: Unable to load .properties file
fbiaggi Feb 11, 2005 12:29 PM (in response to monocongo)Hi,
try this (file in /jboss/bin/):
ClassLoader loader = Thread.currentThread().getContextClassLoader();
InputStream is = loader.getResourceAsStream("my.properties");
or:
java.net.URL url =
ClassLoader.getSystemResource("my.properties");
myProps = new java.util.Properties();
myProps.load(url.openStream());