Servers on unix machine are always using en as default locale.
Following is locale output
LANG=en_US
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=C
I just don’t understand if LANG is set correctly then why servers starts with en locale.
In Linux/Unix/Mac, the settings
LC_ALLandLANGcan control the default locale for Java programs. In Windows, the locales are set from the Control Panel, under Regional and Language Options.When the JVM starts in a *nix environment, it will do this:
LC_ALLLC_ALLdoesn’t exist, scan the environment forLANGuser.languageis set, use that in place of the environment variables.en_US(I believe this is the final failure case)In your environment, you have
LC_ALLset toC, which is just the C locale. It’s basically a traditional fallback to the days when locales weren’t used.You can change
LC_ALLin your case, and restart your JVM, and you should get a new value forjava.util.Locale.getDefault().Example:
Here’s running:
Also note that if you’re running Java 1.7.0-b147, there is a bug with the JRE not recognizing environment settings for locale, and will always use the default system locale.
Bug report here: https://bugs.java.com/bugdatabase/view_bug?bug_id=7073906