我有一个非常简单的属性文件测试,我正在尝试让它工作:(下面是TestProperties.java)
代码语言:javascript复制package com.example.test;
import java.util.ResourceBundle;
public class TestProperties {
public static void main(String[] args) {
ResourceBundle myResources =
ResourceBundle.getBundle("TestProperties");
for (String s : myResources.keySet())
{
System.out.println(s);
}
}
}和TestProperties.properties在同一目录下:
代码语言:javascript复制something=this is something
something.else=this is something else我也将其保存为TestProperties_en_US.properties
当我在Eclipse中运行TestProperties.java时,它找不到属性文件:
代码语言:javascript复制java.util.MissingResourceException:
Can't find bundle for base name TestProperties, locale en_US我做错了什么吗?