title: Why can't my system find my properties file?
body: <p>I have a properties file called <code>admin.properties</code> under <code>src/config</code> and whenever I run the program it gives me this error:</p>
  
  <blockquote>
    <p>java.io.FileNotFoundException: admin.properties (The system cannot find the file specified)</p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code>package com.in.props;
  
  public class Props {
      public static void main(String[] args) {
          String filePath = "config/admin.properties";
          Properties adminProps = new Properties();
          adminProps.load(new FileInputStream(filePath));
          String userName = adminProps.getProperty("userName").trim();
          String password = adminProps.getProperty("password").trim();
      }
  }
  </code></pre>
  
  <p>Here's the properties file, admin.properties:</p>
  
  <pre><code>userName=test
  password=test
  </code></pre>
  
  <p>My <code>Props</code> class (in <code>com.in.props</code>) and the <code>admin.properties</code> (in <code>config</code>) are under different directories.</p>
  
  <pre><code>Project_Root
  -src
   -config
     -admin.properties
   -com
     -in
       -props
         -Props.java
  </code></pre>
  
  <p>I am not using eclipse and I want to execute this via command prompt.</p>