title: How to read configuration file using absolute path?
body: <p>I have a configuration file from which I have to read some properties. This configuration file exists in diferent locations but has the same name. I am able to read a configuration file, but only one from my project. I used the following code:</p>
  
  <pre><code>Properties prop = new Properties();
      String propFileName = "config.properties";
  
  
      InputStream inputStream = getClass().getClassLoader().getResourceAsStream(propFileName);
  
      try {
          prop.load(inputStream);
      } catch (IOException e2) {
          // TODO Auto-generated catch block
          e2.printStackTrace();
      }
      if (inputStream == null) {
          try {
              throw new FileNotFoundException("property file '" + propFileName + "' not found in the classpath");
          } catch (FileNotFoundException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
      }
  </code></pre>
  
  <p>I have to open the config file using the full path so instead of propFileName="config.properties" to insert the absolute path to the config file. The config file can't be opened if I use the absolute path.
  How can this be done ?</p>