为什么我用java读取配置文件第一行的数据读不出来
public static void main(String[]args){
Properties p = new Properties();
String proFile="e://aa//properties.properties";
try {
p.load(new FileInputStream(proFile));
String userName=new String(p.getProperty("userName").getBytes("ISO-8859-1"),"utf-8");
System.out.println(p.getProperty("abc"));
String pwd=p.getProperty("pwd");
String pwd2=p.getProperty(new String("密码".getBytes("utf-8"),"ISO-8859-1"));
pwd2=new String(pwd2.getBytes("iso-8859-1"),"utf-8");
String work=p.getProperty(new String("工作".getBytes("utf-8"),"iso-8859-1"));
System.out.println(userName);
System.out.println(pwd);
System.out.println(pwd2);
System.out.println(work);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
配置文件:
ip=172.17.3.250
port=8080
pwd=123456
密码=没有密码
userName=张三
工作=tarena