java.locale.providers
Java System Property determines which locale provider used to format or parse dates, times, currencies, languages, countries, and time zones.The default value will differ based upon the version of java.
CLDR
- Locales based on the Unicode Consortium's CLDR. The CLDR version used depends on the Java version. As of Java 21 it is CLDR release 43.HOST
- A provider that reflects the user's custom settings in the underlying operating system. This provider enables the default locale(s) (Locale.Category.FORMAT and/or Locale.Category.DISPLAY) utilizing the underlying operating system. In Oracle's JDK 21, this provider is available on Windows platform and macOS platform.SPI
- Represents the locale sensitive services implementing the locale sensitive SPIs in java.text.spi and/or java.util.spi packages.COMPAT
- Compatible with Java versions up to Java 8. Removed in Java 23.JRE
same as COMPAT
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.
You can find more information about java.locale.providers
from these sources:
Java has supported the java.locale.providers
system property since Java 9, and later versions of Java 8.
java.locale.providers
on StartupYou 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
java.locale.providers
at RuntimeYou 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"); }