getBundle can not find properties file
I am trying to use a property file to store my google checkout merchant information. Whe开发者_如何学Cn I call ResourceBundle.getBundle("com_google_checkout_example_settings");
I get the error:
java.util.MissingResourceException: Can't find bundle for base name com_google_checkout_example_settings, locale en_US
Where do I need to put the properties file so getBundle() can find it? do I need to add the locale to the properties file?
The file needs to be included in your classpath. If it already is being included but is inside a package then you need to provide the full path - ie: ResourceBundle.getBundle("com/google/example/checkout_settings.txt")
Where do I need to put the properties file
Put into classpath, so that runtime it should be available.
for web app put it in WEB-INF/classes/
for jar add it to some package and then
ResourceBundle.getBundle("some/package/resources.properties");
精彩评论