This question seems insanely simple, yet I'm embarrased to say I haven't been able to figure out how it works.
I want my Java SE application to get its number format from whatever is configured in the OS. Just like any other application on that OS.
My target is primarily Windows. Consider this example in Windows:
I use this little example to check the result:
public class MyMain {
public static void main(String[] args) {
DecimalFormat decFormat = new DecimalFormat();
DecimalFormatSymbols decSymbols = decFormat.getDecimalFormatSymbols();
System.out.println("Decimal separator is : " + decSymbols.getDecimalSeparator());
System.out.println("Thousands separator is : " + decSymbols.getGroupingSeparator());
}
}
With the screenshot example above my little Java example prints:
Decimal separator is : ,
Thousands separator is : .
I would have expected it to say that the decimal separator is a dot and the thousands separator is a comma - because that's what I've told Windows and that's what all other Windows applications pick up.
I'm under the impression that in Windows these settings take effect for new processes. I've tried restarting my IDE. Didn't help.
What am I doing wrong?