guanxf

          我的博客:http://blog.sina.com.cn/17learning

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            71 隨筆 :: 1 文章 :: 41 評論 :: 0 Trackbacks
          1、配置文件(project.properties ):
            xzql.refFilePath=www.baidu.com
          2、讀取properties文件:
          try{
                  /* 創建輸入流 */  
                   InputStream is = this.getClass().getClassLoader().getResourceAsStream("project.properties"); 
                    Properties p = new Properties();
                try {
               p.load(is);       //Properties 對象已生成,包括文件中的數據
                }catch(IOException e){
                 e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
                }
                
                String refFp=p.getProperty("xzql.refFilePath");

          posted on 2012-05-17 11:02 管先飛 閱讀(372) 評論(0)  編輯  收藏 所屬分類: Java技術
          主站蜘蛛池模板: 岳池县| 鸡泽县| 沿河| 威海市| 宁波市| 赫章县| 黄骅市| 定南县| 白玉县| 库尔勒市| 辽阳县| 武穴市| 巫山县| 湖南省| 神农架林区| 大兴区| 张家口市| 长武县| 岳阳县| 建德市| 沙田区| 平利县| 浮梁县| 东光县| 泰安市| 呼伦贝尔市| 时尚| 重庆市| 屏东市| 沙洋县| 西青区| 乾安县| 台前县| 健康| 金乡县| 兴义市| 安多县| 涿鹿县| 兰西县| 新沂市| 张家港市|