title: How to load and read the multiple property files using java
body: <p>I have 3 property files like <code>web1.properties</code>, <code>web2.properties</code>, <code>web3.properties</code>. I would like to load all the property files at a time using single property object.</p>
  
  <pre><code>Properties prop = new Properties();
  prop.load("web1.properties");
  prop.load("web2.properties");
  prop.load("web3.properties");`
  </code></pre>
  
  <p>I'm Trying the below code for load multiple property files.</p>
  
  <pre><code>public class ReadFileExtension {
      static Properties prop = new Properties();
      public static void main(String[] args) throws IOException {
          String projectFolder = System.getProperty("user.dir");
          File f1 = new File(projectFolder);
          File[] listOfFiles = f1.listFiles();
          System.out.println("Length:"+listOfFiles.length);
          for(int i=0;i&lt;listOfFiles.length;i++){
              if (listOfFiles[i].isDirectory()) {
                  //System.out.println("File " + listOfFiles[i].getAbsolutePath());
                  String prop1 = listOfFiles[i].getAbsolutePath();
                  if(prop1.contains("properties")){
                      System.out.println(prop1);
  
                      File folder = new File(prop1);
                      File[] listOfFiles1 = folder.listFiles();
  
                          for (int j = 0; j &lt; listOfFiles1.length; j++) {
                            if (listOfFiles1[j].isFile()) {
                              //System.out.println("Feature File: " + listOfFiles1[j].getAbsolutePath());
                              //prop.load(new FileInputStream(listOfFiles1[j].getAbsolutePath()));
                              prop.load(Thread.currentThread().getContextClassLoader().getResourceAsStream(listOfFiles1[j].getAbsolutePath()));
                            } 
                          }
                  }
                } 
          }
          System.out.println("Prop 1: "+prop.getProperty("ApplicationURL"));
          System.out.println("Prop 2: "+prop.getProperty("Application"));
      }
  }
  </code></pre>