Given this error message when running your application:
Exception in thread “main” java.util.MissingResourceException: Can’t find bundle for base name MessageBundle, locale
And given that the MessageBundle.properties file has been created, exists on your disk, and is properly formatted.
What is the cause of the error message?
A.
The file is not in the environment path.
B.
The file is not in the classpath.
C.
The file is not in the javapath.
D.
You cannot use a file to store a ResourceBundle.
Explanation:
ResourceBundle.getBundle is using a resource name; it isn’t called ResourceBundle for nothing.You can create a custom ClassLoader and use that to load the data.
Why not Classpath? I didn’t see the point why D?
class path is for JDK and external Jars,
For me is B the correct answer
I also think is B
It is D. We cannot use “MessageBundle.properties”. Instead we must use “MessageBundle_xx_YY.properties”, where xx is language code and YY is region code. For example, “MessageBundle_en_US.properties” will work in this example.
YY is also called country code.
Sorry I was wrong. We can actually use “MessageBundle.properties”, with the default locale. Thus it should be B.
B