title: i want relative path for a file in java
body: <p>I am new to java. I want to read a properties file in java. But i have my properties file in a different path in the same project. </p>
  
  <p>I don't want to hard-code it. I want try with dynamic path.
  Here is my code,</p>
  
  <pre><code>     Properties properties = new Properties();
       try{
          File file = new File("myFile.properties");
          FileInputStream fileInput = new FileInputStream(file);
  
          properties.load(fileInput);
  
       }catch(Exception ex)
       {
           System.err.println(ex.getMessage());
       }
  </code></pre>
  
  <p>my file is in the folder, <code>webapp/txt/myFile.properties</code>.</p>
  
  <p>Can any one help me in solving this issue?.</p>