I am running a debug session in Eclipse (Kepler).
I'm trying to figure out why I can not initialize my PropertyReader
.
This code runs fine outside of Eclipse.
I have a properties folder that I put my property file in. I verify that I am in fact running out of the folder just above it. Using
String current = new java.io.File( "." ).getCanonicalPath();
System.out.println("Current dir:"+current);
String currentDir = System.getProperty("user.dir");
System.out.println("Current dir using System:" +currentDir);
So on to the code that is confounding me
File testFile = new File("./properties/my.properties");
if (testFile.exists()) {System.out.println("It exists darn it");}
reader = new PropertyReader("./properties/my.properties");
So, the new File and test prints out "It exists darn it" to the console. Showing me that I can read the file. But the next line blows up with the exception
Caused by: java.util.MissingResourceException: Can't find bundle for base name ./properties/my.properties, locale en_US
So what gives? I've tried adding the property file folder to the class path explicitly. I've tried absolute path with the file name, nothing works.
But I can read it with FileReader
, File says it exists. This code works fine when compiled. I'm on Fedora 22 and I'm at a loss at why I can see this in code but not with PropertyReader
. This happens whether I'm trying to do a debug session or just run it via Eclipse.