I have a file which is located in my project directory:
src/test/resources/250.csv
This is the code that needs it:
CSVReader reader = new CSVReader(new FileReader(FILE_PATH));
FILE_PATH should be a String
How do I turn this path:
final String FILE_PATH = "C:\\Users\\Kowalski\\Desktop\\test-master\\test1\\src\\test\\resources\\250.csv"
into something more reliable and relative?
I need to be able to run my code on Windows and Linux and move this resource file along with the project, so I don't have to specify absolute paths to reach it, but paths relative to my project instead.
I read this question about it, but couldn't apply it to my case: Absolute Path of Project's folder in Java
EDIT: I have 4 weeks of experience and I consider myself really new to the language
EDIT: This is the accepted answer's solution:
final String FILE_PATH = "src/test/resources/250.csv";