I am trying to use the ResourceBundle class to retrieve the locale-specific text for my application, but I encounter some errors.
java.lang.ClassCastException: org.project.MyClass cannot be cast to ResourceBundle java.util.MissingResourceException: Can't find bundle for base name org.project.MyClass, locale en_US
The code I use to create the ResourceBundle looks like this:
static final ResourceBundle i18ln = ResourceBundle.getBundle("org.project.MyClass", Locale.getDefault());
I searched for about an hour on how to specify the location of a resource file without success. My project is configured as follows:
project-folder /
src /
org /
project /
Myclass.java
test /
lib /
res /
images /
org /
project /
MyClass.properties
Is my project structure simply not compatible with the Java ResourceBundle? Does anyone know how I can make this work?
source share