title: Load .properties file from Class Path in Java
body: <p>I have to access my .properties file from its class path. Currently I am accessing that from the resources folder directly. But now I want to acess that from the class path.</p>
  
  <p>Current Code:</p>
  
  <pre><code>   public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException
  try {
      properties.load(new FileInputStream(
              "src/resources/config.properties"));
      for (String key : properties.stringPropertyNames()) {
          String value = properties.getProperty(key);
          rate.add(value);
      }
  }
  }
  </code></pre>
  
  <p>Path of the file is :<code>src/resources/config.properties</code></p>
  
  <p>For deploying the code we are creating war file of the complete project.</p>
  
  <p>Please suggest how can we get this file from the class path.</p>