`
tntxia
  • 浏览: 1485681 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

Java Properties文件的读取

 
阅读更多

1. 使用ResourceBundle

 

ResourceBundle rb = ResourceBundle.getBundle("jdbcPath");
		String filePath = rb.getString("filePath");
 

 

2. 使用自带的Properties 类

 

 

 

try {   
            InputStream in = new BufferedInputStream(new FileInputStream(   
                    PROPERTY_FILE));   
            props.load(in);   
            in.close();   
            String value = props.getProperty(key);   
            return value;   
        } catch (Exception e) {   
            e.printStackTrace();   
            return null;   
        }
 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics