title: java.util.Properties$LineReader.readLine
body: <p>I need to read a config file
  I get this error while running the following code:</p>
  
  <p><code>java.util.Properties$LineReader.readLine</code></p>
  
  <p>The file config.cfg is present and has r/w permissions.</p>
  
  <pre><code>import java.util.*;
  import java.util.Properties;
  
  public class Config   
  {
   Properties configFile;
   public Config()
   {
  configFile = new java.util.Properties();
  try {           
    configFile.load(this.getClass().getClassLoader().
    getResourceAsStream("config.cfg"));           
  }catch(Exception eta){
       eta.printStackTrace();
  }
  }
  
  public String getProperty(String key)
  {
  
   String value = this.configFile.getProperty(key);       
   return value;
  
   }
  
  }
  </code></pre>
  
  <h2>EDIT - Full Error</h2>
  
  <pre><code> [java] java.lang.NullPointerException
   [java]     at java.util.Properties$LineReader.readLine(Properties.java:418)
   [java]     at java.util.Properties.load0(Properties.java:337)
   [java]     at java.util.Properties.load(Properties.java:325)
   [java]     at Config.&lt;init&gt;(Unknown Source)
   [java]     at ClosureBuilder.&lt;clinit&gt;(Unknown Source)
  </code></pre>
  
  <h2>EDIT - Directory Structure</h2>
  
  <p>src</p>
  
  <p>-> config.java</p>
  
  <p>-> config.cfg    </p>