Reputation: 84
I should design a localized App,But finally this error returns :
Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name messages, locale fa
Piece of code:
ResourceBundle bundle =
ResourceBundle.getBundle("messages",new Locale("fa"));
and image from my project structure(I tested it jsp page with similar error now I'm testing in a class with main method (TestCalender.java)) :
I saw similar questions and test their answers but no changes detected in my error!
Upvotes: 2
Views: 1177
Reputation: 84
I found that :
Because of I'm using Maven and Some configs should add to pom.xml
file for adding resources to target
dir.
Here's what I did:
<plugins>
<!--Some plugins omitted >
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include> **/*.properties</include>
</includes>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include> **/*.xml</include>
</includes>
</resource>
</resources>
Upvotes: 2