Unable to find a package for a base name that does not address similar issues

I have to develop 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

      

Part of the code:

 ResourceBundle bundle =
            ResourceBundle.getBundle("messages",new Locale("fa"));

      

and an image from my project structure (I tested it on a jsp page with a similar error, now I'm testing in a class with a main method (TestCalender.java)):

enter image description here


EDIT:

I've seen similar questions and tested their answers, but no change was found in my error!

+3


source to share


1 answer


I found out that:

Due to the fact that I am using Maven and some configs have to be added to the file pom.xml

to add resources to the 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>

      

+3


source







All Articles