How do I permanently change java's default locale on Windows

Manos Dilaverakis picture Manos Dilaverakis · Jul 10, 2009 · Viewed 20.2k times · Source

I need to change the default locale that java uses on a Windows 2008 Server machine. Java is installed as part of an Oracle + Application server setup. I can do this in code, but I need to permanently change this setting.

Edit: I should note that we're talking about jsp pages served via Application server so I can't exactly pass command line arguments to java. Also the machine's regional and language options are already set to what I need (Greek). Java's default locale is still en_US instead of el_GR.

Edit and solution: I was porting an existing app to a new server. The app took the default locale for granted, which didn't work out so well on the new server (it-works-on-my-machine in all its glory). I was hoping of not having to touch the code itself, but finally decided to explicitly set the default locale in-code in a file that's already included by all the pages. Not the most elegant of solutions, but wth, it works.

Answer

Nate picture Nate · Jul 10, 2009

Would specifying the locale on the command like that starts the JVM work?

java -Duser.language=2-char-language-code -Duser.region=2-char-country-code

http://www.oracle.com/technetwork/articles/javase/locale-140624.html