Java System Properties
Quick Reference Guide


java.locale.providers Java System Property

The java.locale.providers Java System Property determines which locale provider used to format or parse dates, times, currencies, languages, countries, and time zones.

Default Value

The default value will differ based upon the version of java.

Locale Providers

Background Information

The Java Locale Provider determines how dates, times, currencies, languages, countries, and time zones are formatted and parsed by the Java Runtime APIs.

As of Java 9, via JEP-252, the default locale provider was changed to use the the Common Locale Data Repository or CLDR, which is maintained by the Unicode Consortium. The legacy provider can still be used by specifying COMPAT in this system property. The JRE value is a an alias for COMPAT.

Support for this property was added to Java 8 so that you can test your applications on CLDR providers.

Java 11 updated to CLDR release 33

Java 20 updated CLDR to release 40, which can cause some issues with date / time parsing.

Java 21 updated CLDR to release 43.

The COMPAT mode has been removed in Java 23.

References

You can find more information about java.locale.providers from these sources:

Supported Since

Java has supported the java.locale.providers system property since Java 9, and later versions of Java 8.

Setting java.locale.providers on Startup

You can set the java.locale.providers java system property during startup of the java runtime using the -D command line argument:

java -Djava.locale.providers=COMPAT MyAppMain

You may also be able to specify java.locale.providers via the JAVA_TOOL_OPTIONS environment variable:

JAVA_TOOL_OPTIONS=-Djava.locale.providers=COMPAT

Setting / Reading java.locale.providers at Runtime

You can set java.locale.providers at runtime with the following Java code:

System.setProperty("java.locale.providers", "COMPAT");

WARNING: Depending on the property and JVM version using setProperty may or may not work if the JDK Java class that uses this variable has already been loaded. The value of the java.locale.providers system property may be cached within an internal private static variable of the implementing class.

To read the value of java.locale.providers at runtime, you can use this Java code:

String propertyValue = System.getProperty("java.locale.providers");
if (propertyValue != null) {
    System.out.println("java.locale.providers = " + propertyValue);
} else {
    System.out.println("java.locale.providers was null");
}