0

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.

  • 1
    what is the actual problem is it trying to look at some other place ? or on relative path? – jmj Sep 06 '10 at 13:07

1 Answers1

0

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
  • 12,608
  • 14
  • 63
  • 85