The following Java code throws an InputMismatchException in Apache Netbeans 12.6 (with JDK 17) when looking for nextDouble():
import java.util.Locale;
import java.util.Scanner;
public class DecimalTest {
public static void main(String[] args) {
String line = "Number,99.5";
Scanner scLine = new Scanner(line).useDelimiter(",");
System.out.println(scLine.next() + " " + scLine.nextDouble());
}
}
The error is caused by my regional setting in Win10 being set to South Africa which uses a comma as the decimal symbol. Changing the decimal symbol in Win10 has no effect.
Netbeans does not honour the decimal setting in Win10, but follows the region setting only.
Skomisa has previously explained here that:
"You can permanently set the default locale used by NetBeans, by specifying it in the file etc/netbeans.conf within your NetBeans installation directory:
Open that file in any text editor. Locate the line containing the text netbeans_default_options Add the values to specify the language and country of the locale. for example, to set the locale to US English: -J-Duser.language=en -J-Duser.country=US"
I have tried this, but it has not effect.
How can you change the default settings in Apache Netbeans to force it to use a particular locale?