I've got confused by getResourceAsStream()
;
My package structure looks like:
\src
|__ net.floodlightcontroller // invoked getResourceAsStream() here
|__ ...
|__ resources
|__ floodlightdefault.properties //target
|__ ...
And I want to read from floodlightdefault.properties. Here is my code, lying in the net.floodlightcontroller
package:
package net.floodlightcontroller.core.module;
// ...
InputStream is = this.getClass().getClassLoader()
.getResourceAsStream("floodlightdefault.properties");
But it failed, getting is == null
. So I'm wondering how exactly does getResourceAsStream(file)
search for the file
. I mean does it work through certain PATH
s or in a certain order?
If so, how to config the places that getResourceAsStream()
looks for?
Thx!