import java.util.Iterator;
import java.util.Properties;
public static String getPropertiseValue(String fileName, String keyStr){
String value = "";
Properties prop = new Properties();
try{
String classPath = Thread.currentThread().getContextClassLoader().getResource("/").getPath();
//读取属性文件a.properties
InputStream in = new BufferedInputStream (new FileInputStream(classPath + fileName));
prop.load(in); ///加载属性列表
Iterator<String> it=prop.stringPropertyNames().iterator();
while(it.hasNext()){
value = prop.getProperty(keyStr);
if(value.length() > 0){
break;
}
}
in.close();
}
catch(Exception e){
e.printStackTrace();
}
return value;
}