This one ticked me off for a long time until I finally read it in
java spec., I think! If you just want to get a list of properties
in the file and use it somewhere in your java program then why don't you use java.util.ResourceBundle? It's much more convenient and easy to use.
If test.properties is a top class (not in a package):
ResourceBundle rb = ResourceBundle.getBundle("test.properties>);
If test.properties is in the same package as the class accessing it:
ResourceBundle rb = ResourceBundle.getBundle("test.properties>);
If test.properties is in a package named com.mypackage and you are accessing it from some other package:
ResourceBundle rb = ResourceBundle.getBundle("com/mypackage/test.properties>);
To get a property:
String propValue = rb.getString("propertyName");
Much more easier, ain't it?