What is the cause of the error message?

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?

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.



Leave a Reply 8

Your email address will not be published. Required fields are marked *


Julia

Julia

Why not Classpath? I didn’t see the point why D?

Bahaa Khateib

Bahaa Khateib

class path is for JDK and external Jars,

Francesco

Francesco

For me is B the correct answer

Jav

Jav

I also think is B

Tim

Tim

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.

Tim

Tim

YY is also called country code.

Tim

Tim

Sorry I was wrong. We can actually use “MessageBundle.properties”, with the default locale. Thus it should be B.