title: How to use a .properties file in Eclipse Java Dynamic Web Project?
body: <p>I'm developing a Dynamic Web Project in Eclipse. I created a .properties file for store database details (Username, Password etc.). I added it by right clicking on the project and New -> File . I used the Java util package Properties class. But it does not working. I can not retrieve any property from the file. Here is the code I used,</p>
  
  <pre><code>Properties prop = new Properties();
  
      try {
  
          prop.load(new FileInputStream("database.properties"));
  
          String db = prop.getProperty("database");
          String userName = prop.getProperty("dbuser");
          String password = prop.getProperty("dbpassword");
  
      } catch (IOException ex) {
          ex.printStackTrace();
      }
  </code></pre>
  
  <p>Is there something wrong or Is there any particular place where I should put properties file.</p>