title: Java path to file in src/main/resources
body: <p>I have a maven module with the following directory structure and I want to get the path to <code>abc.access</code> in <code>abcManager.java.</code></p>
  
  <pre><code>src
   |-main
      |-java
         |-org.abc.xyz
            |-init
               |-abcManager.java
      |-resources
         |-abc.access
  </code></pre>
  
  <p>I tried it using <code>abcManager.class.getResource("abc.access")</code> but it gives a null.</p>
  
  <p>I went through the below questions but the solutions didn't work.</p>
  
  <p><a href="https://stackoverflow.com/questions/28673651/how-to-get-the-path-of-src-test-resources-directory-in-junit">How to get the path of src/test/resources directory in JUnit?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/26609592/cant-get-path-to-resource">Can&#39;t get path to resource</a></p>