Resource files not found from JUnit test cases
Summary My JUnit tests are not finding the files they require during execution. I'm using Maven for dependency management and compilation. Details All files required by the test cases are located in: src/test/resources . For example, src/test/resources/resourceFile.txt . To access a resource I use the following code: URL url = getClass().getResource("/resourceFile.txt").getFile(); File file = new File(url); But then file.exists() returns false . And the error I get is: Tests in error: myJUnitTestCase(tests.MyJUnitTestClass): /home/me/workspace/Project%20Name/target/test-classes/resourceFile