getBundle找不到属性文件

Lum*_*mpy 3 java properties google-checkout

我正在尝试使用属性文件来存储我的Google Checkout商家信息.我打电话的时候ResourceBundle.getBundle("com_google_checkout_example_settings");

我收到错误:

java.util.MissingResourceException: Can't find bundle for base name com_google_checkout_example_settings, locale en_US
Run Code Online (Sandbox Code Playgroud)

我需要在哪里放置属性文件,以便getBundle()可以找到它?我是否需要将语言环境添加到属性文件中?

小智 5

该文件需要包含在您的类路径中.如果它已经被包含但是在包内,那么你需要提供完整的路径 - 即:ResourceBundle.getBundle("com/google/example/checkout_settings.txt")