title: Java/Gradle reading external config files
body: <p>My project structure looks like below.  I do not want to include the config file as a resource, but instead read it at runtime so that we can simply change settings without having to recompile and deploy.  my problem are two things</p>
  
  <ol>
  <li>reading the file just isn't working despite various ways i have tried (see current implementation below i am trying)</li>
  <li>When using gradle, do i needto tell it how to build/or deploy the file and where?  I think that may be part of the problem..that the config file is not getting deployed when doing a gradle build or trying to debug in Eclipse.</li>
  </ol>
  
  <p>My project structure:</p>
  
  <pre><code>myproj\
          \src
              \main
                  \config
                      \com\my_app1\
                                  config.dev.properties
                                  config.qa.properties
                  \java
                      \com\myapp1\
                                  \model\
                                  \service\
                                  \util\
                                      Config.java
              \test              
  </code></pre>
  
  <p>Config.java:</p>
  
  <pre><code>public Config(){
          try {
              String configPath = "/config.dev.properties"; //TODO: pass env in as parameter
              System.out.println(configPath);
              final File configFile = new File(configPath);
              FileInputStream input = new FileInputStream(configFile);
  
              Properties prop = new Properties()
              prop.load(input);
              String prop1 = prop.getProperty("PROP1");
              System.out.println(prop1);
          } catch (IOException ex) {
              ex.printStackTrace();
          } 
      }   
  </code></pre>