|
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|
| 30 | 1 | 2 | 3 | 4 | 5 | 6 |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 | 1 | 2 | 3 |
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
Java中提供了一个java.util.Properties工具类,使用Properties类您可以方便的从一个.properties属性文件中读取设置参数,示例代码如下:
Properties props = new Properties();
props.load(new FileInputStream("filename.properties"));
String value = props.getProperty("propertyname");
如果您的.properties文件打包入一个Jar或War文件,您可以使用ClassLoader的getResourceAsStream()方法得到一个InputStream对象,示例代码如下:
Properties props = new Properties();
props.load(getClass().getResourceAsStream("com/company/application/application.properties"));
String value = props.getProperty("propertyname");
作者:Jonathan's SUN 阅读()
评论() 编辑 发表于:2005-04-13 19:38
相关内容
文章评论
暂无人对此文章发表评论!
发表评论