易网时代-编程资源站
Welcome
微信登录
编程资源
图片资源库
蚂蚁家优选
PDF转换器
软件资源
软件开发
、
小程序制作
、
系统集成与运维
、
空间租用
、
硬件开发
、
视频监控
、
技术咨询与支持
——联系电话:0311-88999002/88999003
首页
/
操作系统
/
Linux
/
Java读取配置Properties文件
config.properties:
author
=
xmq
user
=
xmq
copyright
=
2012
-2015
java文件:
import
java.io.FileInputStream;
import
java.util.Enumeration;
import
java.util.Properties;
class
PropTest {
public
static
void
main(String[] args) {
Properties pps=
new
Properties();
try
{
pps.load(
new
FileInputStream(
"config.properties"
));
Enumeration
enum
= pps.propertyNames();
while
(
enum
.hasMoreElements()) {
String strKey = (String) enum1.nextElement();
String strValue = pps.getProperty(strKey);
System.out.println(strKey +
"="
+ strValue);
}
}
catch
(Exception e) {
e.printStackTrace();
}
}
}
收藏该网址
版权所有©石家庄振强科技有限公司2024
冀ICP备08103738号-5
网站地图