The Answer to Life, the Universe, and Everything

Friday, November 23, 2007

Java:Loading the file

The dev environment and the actual service server are different and often face the problem of path to the config file with FileNotFound Exception or so. Here is a solution.

URL propXML = this.getClass().getResource(RESFILE);
Configuration config = new XMLConfiguration(propXML);


ClassLoader loader = Thread.currentThread().getContextClassLoader();

No comments: