guanxf

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

            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            71 隨筆 :: 1 文章 :: 41 評論 :: 0 Trackbacks
          1、配置文件(project.properties ):
            xzql.refFilePath=www.baidu.com
          2、讀取properties文件:
          try{
                  /* 創(chuàng)建輸入流 */  
                   InputStream is = this.getClass().getClassLoader().getResourceAsStream("project.properties"); 
                    Properties p = new Properties();
                try {
               p.load(is);       //Properties 對象已生成,包括文件中的數(shù)據(jù)
                }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 管先飛 閱讀(371) 評論(0)  編輯  收藏 所屬分類: Java技術(shù)
          主站蜘蛛池模板: 新宁县| 临桂县| 乌审旗| 舟曲县| 贵定县| 宿州市| 洛南县| 河间市| 甘泉县| 沿河| 南和县| 台州市| 祁门县| 永仁县| 平罗县| 麻栗坡县| 高陵县| 浦县| 东阳市| 丰台区| 南木林县| 黔西县| 淮阳县| 绥化市| 湘西| 从江县| 舒兰市| 安宁市| 海宁市| 泸水县| 洮南市| 京山县| 青铜峡市| 武川县| 孟津县| 上思县| 宣威市| 巴塘县| 丰县| 修文县| 云林县|