title: Reading .properties file in java
body: <p>I have created a properties file in the location conf/Config.properties. The folder is under the project's root folder in Eclipse. I also added this to the .classpath.</p>
  
  <p>I am reading the data from this file using the code: </p>
  
  <pre><code>InputStream in = getClass().getResourceAsStream("conf/Config.properties");
  Properties properties = new Properties();
  properties.load(in);
  String fromEmail = properties.getProperty("emailID");
  System.out.println("from email is " + fromEmail);
  String fromEmailPass = properties.getProperty("emailPass");
  String host = properties.getProperty("host");
  </code></pre>
  
  <p>This gives the error : </p>
  
  <pre><code>java.lang.NullPointerException
      at java.util.Properties$LineReader.readLine(Properties.java:418)
      at java.util.Properties.load0(Properties.java:337)
      at java.util.Properties.load(Properties.java:325)
      at com.sendum.integration.activities.notifications.ActivityImplSendActivationEmail.activateEmail(ActivityImplSendActivationEmail.java:23)
  </code></pre>
  
  <p>How do I read the data from the .properties file ?</p>