I am wondering why the method getResource
keeps returning null
, I have the following setup:
public static URL getResource(String path){
URL url = ResourceLoader.class.getResource(path);
if (Parameters.DEBUG){
System.out.println(path);
}
return url;
}
My project structure in Eclipse is as follows:
-- res
-- img
The path
variable I pass to getResource
has the value "/res/img"
or "/res/img/smile.png"
. Yet the method keeps returning null
and url
is not set. I also followed the instructions of this question, which were to add the folder to the project's classpath via Run configurations, still without success... Does anyone know what I am doing wrong?