I have just installed jre7 and I'm surprised to see that my default locale is now en_US. With jre6 it was de_CH.
What is different with jre7? Is the default locale no more the one of the Operating System? (btw, I'm using Windows7)
Thx for your answer.
Edit: I have seen the Locale for Category.FORMAT is the "old" one (de_CH). The Locale for Category.DISPLAY takes the language from the language of the OS (in Windows this is done in Control Panel > Region and Language > Keyboard and Languages > Display Language) and the contry from...?
What seems to be different is the property "user.country". With Java6 I get "CH" and with Java7 I get "US".
The default locale determines the format. The number may be a primitive (such as int or double ) or a wrapper object (such as Integer or Double ). The language is english and the country is Great Britain. Locales specify both language and country.
That is, the JVM determines the default locale from the host environment. The host environment's locale is determined by the host operating system and the user preferences established on that system.
In Java, we can use Locale. setDefault() to change the JVM default locale. Alternatively, in the command line, we can configure the user. country and user.
To get equivalent information in Java, use Locale. getDefault() to get the Locale that Java is using, and use methods on the Locale object such as getCountry() , getLanguage() to get details. The information is available using ISO codes and as human readable/displayable names.
This is as designed. Java 7 has changed the way Locale.getDefault()
works. A defect has been entered with Oracle, but they basically said this is As Designed.
To sum up, you must modify the Display Language of the OS. Modifying the Region Format only is no longer sufficient.
Read the bug report here: Locale.getDefault() returns wrong Locale for Java SE 7
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With