java读取配置文件写法
2016-10-03 15:20
316 查看
package com.lile.util;
import java.io.InputStream;
import java.util.Properties;
public class PropertiesUtil {
public static String getValue(String key){
Properties properties = new Properties();
InputStream is = new PropertiesUtil().getClass().getResourceAsStream("/diary.properties");
try{
properties.load(is);
}catch(Exception e){
}
return (String)properties.get(key);
}
}
import java.io.InputStream;
import java.util.Properties;
public class PropertiesUtil {
public static String getValue(String key){
Properties properties = new Properties();
InputStream is = new PropertiesUtil().getClass().getResourceAsStream("/diary.properties");
try{
properties.load(is);
}catch(Exception e){
}
return (String)properties.get(key);
}
}
相关文章推荐
- Java中读取图片和配置文件的写法
- 利用Java的Properties类读取配置文件信息
- 利用Java的Properties类读取配置文件信息
- java读取配置文件
- Java Properties 类读取配置文件信息
- JAVA高手解析XML配置文件的读取操作
- Java Properties 类读取配置文件信息
- JAVA/读取XML文件中SQLSERVER数据源配置(sax)
- Java Properties 类读取配置文件信息
- java读取配置文件的几种方法 设置代理
- java读取配置文件的几种方法
- java应用程序读取配置文件的方法
- java中读取配置文件的方法和数据库底层的编写
- JAVA读取XML文件并利用该文件对数据库进行配置操作
- java读取配置文件的几种方法
- JAVA技术:XML配置文件的读取处理
- java读取配置文件的几种方法
- Java Properties 类读取配置文件信息
- Java Properties 类读取配置文件信息
- java读取配置文件的几种方法