Java path to file in src/main/resources

Viewed 15645

I have a maven module with the following directory structure and I want to get the path to abc.access in abcManager.java.

src
 |-main
    |-java
       |-org.abc.xyz
          |-init
             |-abcManager.java
    |-resources
       |-abc.access

I tried it using abcManager.class.getResource("abc.access") but it gives a null.

I went through the below questions but the solutions didn't work.

How to get the path of src/test/resources directory in JUnit?

Can't get path to resource

5 Answers
Related