I want to use the ClassLoader to load a properties file for the Properties class. I\'ve simplified the below code to remove error handling for the purposes of this discussio
If the file is in the same directory as the class, you have to prefix the class's package as a directory.
So if your package is:
package com.foo.bar;
Then your code is:
.getResourceAsStream("com/foo/bar/theta.properties");
You can use ResourceBundle
By using getClass().getClassloader()
you look for "theta.properties" from the root path directory. Just use getClass().getResourceAsStream()
to get a resource relative to that class.