首页 > 其他 > 详细

读取properties文件方式

时间:2016-11-04 16:35:21      阅读:191      评论:0      收藏:0      [点我收藏+]
技术分享
 //src目录下
static Properties pro = new Properties();
            //jar包时用(ide也可以)
//            pro.load(Tool.class.getClassLoader().getResourceAsStream("config.properties"))
//            pro.load(ClassLoader.getSystemClassLoader().getResourceAsStream("config.properties"));

            //IDE用
            pro.load(new FileInputStream(Ftpfile.class.getClassLoader().getResource("config.properties").getPath()));
// 生成文件对象
//            File pf = new File(System.getProperty("user.home") + "/Desktop/config.properties");
//            // 生成文件输入流
//            FileInputStream inpf = null;
//            inpf = new FileInputStream(pf);
//            pro.load(inpf);
View Code

 

读取properties文件方式

原文:http://www.cnblogs.com/sprinng/p/6030532.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!