Nat*_*ger 229
我通常首先查看系统属性然后查看类路径.所以:
java -DconfigFile=/filelocation/file.xml
Run Code Online (Sandbox Code Playgroud)
可以理解为:
String propfile = System.getProperty(configFile);
if (propfile != null) {
// read in file
new File(propfile);
...
} else {
// read in file from classpath
getClass.getResource("/configfile.xml")
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12744 次 |
| 最近记录: |