D
D
DarkByte20152017-06-06 07:19:27
Java
DarkByte2015, 2017-06-06 07:19:27

Why can't find resources?

I'm trying to add resources to the console application. Clicked "New Resource Bundle" - added to the root of the project. I write in code

ResourceBundle resources = ResourceBundle.getBundle("resources"); // Пробовал и Locale.getDefault() добавлять.

It gives me the error "java.util.MissingResourceException: Can't find bundle for base name resources, locale ru_RU". What's the matter? There is such a file. With the name already as soon as not refined. And the path was put down and the extension (there are properties, but I also tried xml resources), and the locale shoved _ru_RU and just _ru into the name. Nothing helps. Generally. Doesn't see resources and that's it...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
gubber, 2017-06-06
@gubber

Too little data to give a definitive answer.
The point is that the resources should not be in the root of the project, but in the root of the sources. Those. if you have a simple Java application (not maven, etc.), then your sources are more likely to be in the src folder. This is where you need to put the resource file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question