为什么保存后我的属性文件在eclipse项目中显示为.properties.txt。我已将文件放置在我的包的 src 文件夹中,但仍然为找不到 bundle 抛出异常。
package array;
import java.util.*;
public class AddingToList {
static public void main(String[] args) {
String language;
String country;
if (args.length != 2) {
language = new String("en");
country = new String("US");
} else {
language = new String(args[0]);
country = new String(args[1]);
}
Locale currentLocale;
ResourceBundle messages;
currentLocale = new Locale(language, country);
messages = ResourceBundle.getBundle("MessagesBundle", currentLocale);
System.out.println(messages.getString("greetings"));
System.out.println(messages.getString("inquiry"));
System.out.println(messages.getString("farewell"));
}
}