[jboss-user] [Beginners Corner] - Re: reading a file stored outside the .war
f_marchioni
do-not-reply at jboss.com
Wed Aug 19 17:02:09 EDT 2009
You have a few solution which are not JBoss specific, like looking for the file in the filesystem
try
| {
| url = new File(fileName).toURL();
| is = url.openStream();
| return is;
| }
| catch (MalformedURLException ignore)
| {
| }
| catch (IOException ignore)
| {
|
| }
or in the current classpath:
url =
| Thread.currentThread().getContextClassLoader().getResource(fileName);
| if (url != null)
| {
| try
| {
| return url.openStream();
| }
| catch (IOException ioe)
| {
|
| }
| }
With JBoss you have one service named "Properties MBean Service" which allows loading a property file from an available URL.
See this tip :
http://www.mastertheboss.com/en/jboss-howto/42-jboss-config/151-how-to-inject-system-properties-to-jboss-.html
Hope it helps
Francesco
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4250488#4250488
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4250488
More information about the jboss-user
mailing list