Have a look at the implementation of java.util.Locale.getAvailebleLocales() (JSE 5.0):
The class LocaleData has the fully qualified name sun.text.resources.LocaleData and the source code for this is unfortunately no publically available. Browsing through the OpenJDK makes me believe that the list of available locale should be defined at compile-time. If this is correct there is now way of edit this list at run time.
You can however define your own locale using one of the constructors in the Locale class, and use this as input to the java.util.Locale.setDefault(Locale) method (and of course to whatever method that requires a Locale object as input).
Joined: May 23, 2008
Thanks for the reply.But I want to install a new locale.How I can do that.setDefault method doesn't work because before that I want to install a new locale.
It should be pretty clear from the API documentation that the Locale class doesn't have any methods to install a new locale.
If you then click on the "Use" button at the top of the documentation page for Locale, that shows you everything in the standard API which uses Locale. You can check for yourself that there's nothing in this long list which installs a new Locale either.
An interesting thing you might notice in the list is that there are methods whose descriptions are like, for example, "Gets the date formatter with the given formatting style for the given locale". That implies that internally a Locale has a whole lot more baggage attached to it -- date formatters, number formatters, collators, and so on. You can't define any of that when you create a new Locale but the built-in Locales do have it.
Even the String class has a toLowerCase(Locale) method which uses the rules of the Locale for lower-casing. You wouldn't have any way of dealing with that, either. So installing a new Locale wouldn't be all that useful any way, since you don't have a way of specifying all those Locale-dependent objects and behaviours.