Since I haven't found a better way to traverse up the folders other than using getParentFile()
, I've added the file I want to read to my classpath and got its location by
URL url = Thread.currentThread().getContextClassLoader().getResource(RULES_XML_NAME);
File fXmlFile = new File(url.getPath());
And read the file by using,
File fXmlFile = new File(url.getPath());