码迷,mamicode.com
首页 > 其他好文 > 详细

读取properties文件方式

时间:2016-11-04 16:37:32      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:文件   ges   img   tor   style   目录   生成   home   and   

技术分享
 //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文件方式

标签:文件   ges   img   tor   style   目录   生成   home   and   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!