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());
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());
相关文章推荐
- VMware下Linux与本机互ping的一些问题
- linux驱动入口函数module_init详解
- 关于apache.jasper.el.ELContextImpl的错误
- shell-3-string
- Linux基础(二)
- 大型网站技术架构学习笔记
- PHP编写学校网站上新生注册登陆程序的实例分享
- OP-TEE设计结构(二)
- hadoop Balance 优化
- iOS应用架构谈 本地持久化方案及动态部署
- Windows下通过Git管理创建于Linux的项目,提示文件已修改,Diff得知文件的mode不同
- LINUX SSH 管理与监控
- Don't know how to define struct flock on this system, set --enable-opcach=no
- 3.3.Android控件架构与自定义控件详解之View的绘制
- Linux log 日志 深入分析
- Eclipse下启动Tomcat报错: The archive: F:/JSPDev/apache-tomcat-8.0.32/bin/bootstrap.jar which is referenced by the classpath, does not exist.
- Linux 查看系统基本信息
- Permission denied (publickey). -- Windows下使用Git Bash显示权限错误
- hadoop Balancer 流程
- Linux 命令 --------lsof