Page 1 of 1

About Question enthuware.ocpjp.v7.2.1165 :

Posted: Tue Jul 04, 2017 10:56 am
by AndaRO
I got the exception:

Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name appmessages, locale jp_JP
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1499)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1322)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:795)
at locale2.Locale2.main(Locale2.java:23)


Here is my code:
import java.util.Locale;
import java.util.ResourceBundle;

public class Locale2 {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Locale.setDefault(new Locale("fr", "CA")); //Set default to French Canada
Locale l = new Locale("jp", "JP");
ResourceBundle rb = ResourceBundle.getBundle("appmessages", l);
String msg = rb.getString("greetings");
System.out.println(msg);
}

}

plus the 2 resources messages.

What I am wrong?


Thanks in advance.

Re: About Question enthuware.ocpjp.v7.2.1165 :

Posted: Tue Jul 04, 2017 11:54 am
by AndaRO
It works. I copied the resources file in the folder where are class files.

Sorry.