您的位置:首页 > 运维架构

jar包程序 读取properties文件

2016-03-21 15:33 429 查看
String proFilePath = System.getProperty("user.dir") + "\\Mysettings.properties";
Properties prop = new Properties();
MonitorProperties monitorProperties=new MonitorProperties();

// InputStream in = Object.class.getResourceAsStream(proFilePath);//配置文件在jar包内则用这种形式
InputStream in = new FileInputStream(proFilePath);//配置文件在jar包外面则用这种形式
prop.load(in);
monitorProperties.setServerUrl(prop.getProperty("serverUrl").trim());
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: