/** * 加载Properties配置文件 * * @author ZhangHaiNing * @param file 要读取的文件 * @return */ public static Properties getProp(String file){ Properties prop=new Properties(); try { String url = TelChargeDwr.class.getResource("").getPath().replaceAll("%20", " "); String path = url.substring(0, url.indexOf("WEB-INF")) + "WEB-INF/"; prop.load(new FileInputStream(path+file)); } catch (IOException e) { e.printStackTrace(); } return prop; }