Java读取WEB-INF目录下的properties配置文件
时间:2015-08-12 16:14:21
收藏:0
阅读:330
文件位置:
代码:
public static Properties getProperties(){ Properties pts = new Properties (); FileInputStream in = null; try{ String path = UtilManager.class.getResource("/").getPath(); String websiteURL = (path.replace("/build/classes", "").replace("%20"," ").replace("classes/", "") + "wsdl.properties").replaceFirst("/", ""); System.out.println ("websiteURL:"+websiteURL); in = new FileInputStream(websiteURL); pts.load(in); }catch (FileNotFoundException e){ e.printStackTrace(); }catch (IOException e){ e.printStackTrace(); } return pts; }

原文:http://www.cnblogs.com/staryy/p/4724480.html
评论(0)