Good practice to include XML config in Java classpath?

I usually look in a system property first then the classpath. so:

java -DconfigFile=/filelocation/file.xml

can be read as:

String propfile = System.getProperty(configFile);
if (propfile != null) {
 // read in file
  new File(propfile);
 ...
} else {
  // read in file from classpath
  getClass.getResource("/configfile.xml")
}

Leave a Comment