The following code will help illustrate my problem:
import java.util.Locale; import java.text.*; public class LocaleTest { public static void main(String[] args) { System.out.println(Locale.getDefault()); System.out.println("java-version-" +System.getProperty("java.version")); System.setProperty("sun.locale.formatasdefault","true"); System.out.println("prop:" +System.getProperty("sun.locale.formatasdefault")); System.out.println("getLocale-" +Locale.getDefault()); } }
As we know, in Java 7 there is an error in Locale.getDefault (). However, as recommended by Oracle, I set the system property "sun.locale.formatasdefault" to true. Despite the fact that now I get my m / c Locale, it always displays as en_US, although my m / c Locale is set to fr_BE.
Here is the result of the above code that is compiled and run on Java 1.7.0_09:
en_US
java-version-1.7.0_09
prop: true
getLocale-en_US
Any thoughts on what could be causing? Thank you very much in advance.
source share