Reputation: 4418
I am trying to read a properties file using a resource bundle class in java, but it is giving me a exception saying that
java.util.MissingResourceException: Can't find bundle for base name jira, locale en_US
This is how i am coding in java
ResourceBundle labels = ResourceBundle.getBundle("jira");
This is my project structure
What is that missing? I have read through the documentation and it says that no need to give any absolute path as the Resource bundle handles that.
Upvotes: 0
Views: 511
Reputation: 159754
ResourceBundles
are read from the classpath. WEB-INF/conf
is not on the classpath for web applications. Try placing the property file in WEB-INF/classes
.
From the above image it appears you are using Maven to build the project. In that case the property file can be moved into src/main/resources
folder to be copied into classes
during the Maven build.
Upvotes: 2
Reputation: 68715
The problem is the name of your bundle file. File name should begins with the base name LabelsBundle and ends with the .properties suffix. Since you are trying to load file intended for your default Locale, the base name is followed by the language code (en_US).
jire_en_US.properties
should be the file name of your bundle file instead of just
jira.properties
Upvotes: 0