用eclipse写的Java文件怎么用propertiesk呀
文件结构这样
src--demo11.international
--Message.properties
--InterDemo01.java
而我的java源代码如下:
package demo11.international;
import java.util.Locale;
import java.util.ResourceBundle;
public class InterDemo01 {
public static void main(String[] args) {
ResourceBundle rb = ResourceBundle.getBundle("Message",Locale.getDefault());
System.out.println("内容: " + rb.getString("info"));
}
}
properties代码如下
info = WZY
我用命令行编译运行,得出答案.
但我在eclipse中,却出来了如下的异常
Exception in thread "main"
java.util.MissingResourceException: Can't find bundle for base name Message, locale zh_CN
at java.util.ResourceBundle.throwMissingResourceException(Unknown Source)
at java.util.ResourceBundle.getBundleImpl(Unknown Source)
at java.util.ResourceBundle.getBundle(Unknown Source)
at demo11.international.InterDemo01.main(InterDemo01.java:7)
请问怎么解决,我猜是在包中,访问不到properties文件,求教高手了...
------解决方案--------------------只是访问properties文件吗?