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.
About Question enthuware.ocpjp.v7.2.1165 :
Moderator: admin
-
- Posts: 31
- Joined: Wed Feb 08, 2017 5:42 pm
- Contact:
-
- Posts: 31
- Joined: Wed Feb 08, 2017 5:42 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1165 :
It works. I copied the resources file in the folder where are class files.
Sorry.
Sorry.
Who is online
Users browsing this forum: Google [Bot] and 28 guests