I have a package located at com.foo.bar
. Inside this package I have a config.properties
file, and a Test.java
class. I'm trying to simply load the properties file into an input stream. I have tried this:
InputStream is = Test.class.getClassLoader().getResourceAsStream("config.properties");
System.out.println("stream: " + is );
And also:
String path = "com.foo.bar.config.properties";
InputStream is = Test.class.getClassLoader().getResourceAsStream(path);
System.out.println("stream: " + is );
In both cases, I get:
stream: null
as the value. No exception is thrown.
What am I doing wrong?