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")
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…