views:

52

answers:

1

Hi, I am working on one web application in which i want to retrieve values from property files which are present outside of the application i.e on system drive. but while doing this i am facing the problem.Interestingly if i put property files at class path location then application works properly. I am using resin server 3.0.23 and spring mvc architecture with spring 2.5.4 jars.i am also tried it on resin upgraded version of resin 4.0.9. there also i am getting the same problem.

Is there any compatibility issue of resin server for above query or If there is any other way to solve this issue?

please suggest.

thanks.

A: 

If you want to read a properties file from an arbitrary path on the system you need to do something like

Properties props = new Properties();
props.load(new FileInputStream(somefilename));

If you are trying to load the properties file with calls to getResource() or getResourceAsStream(), your properties file should be somewhere accessible from a ClassLoader, usually on the classpath. Check the docs for Class.getResource and ClassLoader.getResource

agnul