I am trying to export to an excel sheet values using the correct decimal separator according to the SO configured decimal separator on regional settings. I tried using:
private static Locale tp = Locale.getDefault();
DecimalFormatSymbols dfs = new DecimalFormatSymbols(tp);
String sep = Character.toString(dfs.getDecimalSeparator());
But the dfs.getDecimalSeparator() always returns 'comma' even if I change in the regional settings from 'comma' to 'point'.
As far as I understood Locale.getDefault() returns the locale that was initially determined by the Java Virtual Machine (JVM) when it first loaded. 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.
But let's say I don't want to get the Locale's decimal separator, but I want to get what's configured in the regional settings even thought it is not the locales, how do I do that?
C:\Users\admim>java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)