请问如何读出这个message.properties文件,文件内容如下:
MSG_S0_0001="1234566777";
MSG_S0_0002="sssssss";希望给一个MSG_S0_0001,就能把后面的字符串的内容读出来,请问怎么能够做到哪?应该包含哪些包?
最好能给一些可以实现的代码,谢谢
MSG_S0_0001="1234566777";
MSG_S0_0002="sssssss";希望给一个MSG_S0_0001,就能把后面的字符串的内容读出来,请问怎么能够做到哪?应该包含哪些包?
最好能给一些可以实现的代码,谢谢
try {
InputStream in = Thread.currentThread().getContextClassLoader()
.getResourceAsStream("message.properties");
props.load(in);
in.close();
} catch (Exception e) {
}
System.out.println(props.getProperty("MSG_S0_0001"));
最好这样写:
public abstract class VaTextResource {
private final static String MSG_S0_0001= "1234566777";
}
getResourceAsStream("../resource/message.properties");