title: Reading From Config File Outside Jar Java
body: <p>Currently I am trying to read my config file from root of project directory, in order to make this actual configuration I want to move this to external location and then read from there.</p>
  
  <p>Adding a complete path in following code throws out error :</p>
  
  <pre><code>package CopyEJ;
  
  import java.util.Properties;
  
  public class Config
  {
     Properties configFile;
     public Config()
     {
      configFile = new java.util.Properties();
      try {
       // configFile.load(this.getClass().getClassLoader().getResourceAsStream("CopyEJ/config.properties"));
        Error Statement ** configFile.load(this.getClass().getClassLoader().getResourceAsStream("C://EJ_Service//config.properties"));
      }catch(Exception eta){
          eta.printStackTrace();
      }
     }
  
     public String getProperty(String key)
     {
      String value = this.configFile.getProperty(key);
      return value;
     }
  }
  </code></pre>
  
  <p>Here's the error:</p>
  
  <pre><code>java.lang.NullPointerException
      at java.util.Properties$LineReader.readLine(Properties.java:365)
      at java.util.Properties.load(Properties.java:293)
      at CopyEJ.Config.&lt;init&gt;(Config.java:13)
      at CopyEJ.CopyEJ.main(CopyEJ.java:22)
  Exception in thread "main" java.lang.NullPointerException
      at java.io.File.&lt;init&gt;(File.java:194)
      at CopyEJ.CopyEJ.main(CopyEJ.java:48)
  </code></pre>
  
  <p>How can I fix this ?</p>