1、properties配置文件的信息

fcsimage_path=C://FCSImage

2、Java代码

public final class Config {
private static final Object lock = new Object();
private static volatile Properties config; private Config(){} private static Properties getInstance(){
if (config == null)
{
//double lock check
synchronized (lock) { // declare a private static Object to use for mutex
if( config == null ){ // have to do this inside the sync
config = new Properties();
}
}
try {
config.load(Config.class.getClassLoader().getResourceAsStream("common.properties"));
} catch (IOException e) {
e.printStackTrace();
}
} return config;
} public static String fcsimage_path() {
return getInstance().getProperty("fcsimage_path");
} }

读取properties文件的信息-LMLPHP

05-11 11:09