您的位置:首页 > 产品设计 > UI/UE

获取properties中的 value

2015-12-09 09:50 441 查看
<span style="white-space:pre">		</span>Properties log4j_properties = new Properties();
<span style="white-space:pre">		</span>InputStream inputStream = null;
<span style="white-space:pre">		</span>String configKey = "log4j.appender.R.File";
<span style="white-space:pre">		</span>String configPath=""; 
<span style="white-space:pre">		</span>String filePath ="";
<span style="white-space:pre">		</span>try {  
<span style="white-space:pre">			</span>log4j_properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("log4j.properties"));  
<span style="white-space:pre">			</span>configPath = log4j_properties.getProperty(configKey); //根据key值获取value
<span style="white-space:pre">		</span>} catch (IOException e) {  
            e.printStackTrace();  
            System.out.println("配置文件加载出错...");
        }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: