getClass().getResource("/").getPath()
public class Main {
void run() {
String testFilePath = getResourcePath("test");
System.out.println(testFilePath);
}
String getResourcePath(String file) {
return getClass().getResource("/").getPath() + "../resourses/" + file;
}
public static void main(String[] args) {
new Main().run();
}
}
getResourceAsStream()