+3 votes
in Programming Languages by (59.1k points)

I created the .properties files under project in netbeans, but when I run my java program to access those files, it gives me the following error...

java.util.MissingResourceException: Can't find bundle for base name 'MessagesBundle', locale en_US

How can I fix this error?

1 Answer

0 votes
by (59.1k points)

The error 'java.util.MissingResourceException: Can't find bundle for base name 'MessagesBundle', locale en_US' says that your program is not able to access your .properties files. Seems like they are placed in the wrong folder. 

To fix it, either you mention the correct location of .properties file or bring them to src folder of your project.

Whenever you are creating .properties files in Netbeans, don't create them under the main project, create them under source package of the project. This way Netbeans will itself place your .properties files in the default package and you don't have to worry about such errors.