I have spring project. My file here: /src/main/java/resources/file.txt.
How I can get full path of this?
If I run from test it works:
String path = System.getProperty("user.dir") + "/src/main/java/resources/file.txt";
But if I use tomcat, it shows another path inside tomcat folder. So spring cannot find this path.
EDIT: this.getClass().getClassLoader().getResource("file.txt") is null
UPDATED: sorry for stupid question. It works, I set wrong name of file.