java 读取properties配置文件
2008-08-08 16:37
741 查看
public class Content(){
private String getContentRootName()
{
String fileName =Content.class.getResource("/").getPath()
+ "template/content.properties";
fileName = fileName.substring(1);
Properties prop = new Properties();
try {
InputStream is = new BufferedInputStream(new FileInputStream(fileName));
prop.load(is);
if (is != null)
is.close();
} catch (Exception e) {
System.out.println(e + "file " + fileName + " not found");
}
return prop.getProperty("contentRoorName");
}
}
private String getContentRootName()
{
String fileName =Content.class.getResource("/").getPath()
+ "template/content.properties";
fileName = fileName.substring(1);
Properties prop = new Properties();
try {
InputStream is = new BufferedInputStream(new FileInputStream(fileName));
prop.load(is);
if (is != null)
is.close();
} catch (Exception e) {
System.out.println(e + "file " + fileName + " not found");
}
return prop.getProperty("contentRoorName");
}
}
相关文章推荐
- Java读取Properties文件中在配置
- Java 读取Properties配置文件
- java 数据库读取工具类(读取config.properties配置文件)[包含线程安全]
- java读取xml/.properties配置文件
- Java Properties 类读取配置文件信息
- Java Properties 类读取配置文件信息,Java properties文件的操作(zz)
- Java Properties 类读取配置文件信息
- 使用java读取配置文件(ini、properties)
- java IO 使用Properties设置键值对配置信息 写入文件和从文件中读取
- JAVA 读取配置文件 xxx.properties
- java读取properties配置文件
- Eclipse和Tomcat和Java读取配置文件工具类PropertiesUtil
- Java基于Spring配置读取properties文件
- java读取.properties配置文件
- JAVA读取classess下的.properties配置文件封装类,linux和windows上都可以使用
- Java读取Properties配置文件
- Java爬虫历险记 -- (3)通过读取Properties配置文件连接mysql数据库
- java中经常用到的读写配置文件的信息properties属性的写入,读取例子
- java对配置文件.properties文件读取的几种方法
- java读取properties配置文件