Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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".

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
399 views
Welcome To Ask or Share your Answers For Others

1 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...