To change the locale providers in java 9+ (I am using 21 right now) I can start java with:
-Djava.locale.providers=COMPAT,SPI However I tried to set this property programmatically via:
System.setProperty("java.locale.providers", "COMPAT,SPI"); But this not take effect.
The project is a web based application and I add above code in ServletContextListener#contextInitialized method
@WebListener public class StartUp implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent event) { System.setProperty("java.locale.providers", "COMPAT,SPI"); }