How can I change the default Java language on Windows?

I need to change the default locale used by java on a computer running Windows 2008 Server. Java is installed as part of the installation of the Oracle + Application server. I can do this in code, but I need to constantly change this parameter.

Edit: I should note that we are talking about jsp pages served by the application server, so I cannot pass command line arguments to java exactly. In addition, the regional and language settings of the machine are already configured for what I need (Greek). The default Java language is still en_US instead of el_GR.

Change and solve the problem: I was migrating an existing application to a new server. The application took the standard locale for granted, which didn’t work so well on the new server (it works on my machine in all its glory). I was hoping not to touch the code itself, but finally decided to explicitly set the local default code in a file that was already included on all pages. Not the most elegant of solutions, but wth, it works.

+4
source share
5 answers

Does the locale indicate the command that starts the JVM?

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

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

+6
source

There are actually two answers that I found: WRONG provided by http://java.com/en/download/help/locale.xml and a hacked file that works.

I will explain - I am using the French-installed multilingual XP in France with a French keyboard, but I want my applications to speak English with me. The Sun plain page does not work with this combination - Java still speaks French to me.

The HACK solution was to go into regedit and change the HKEY_CURRENT_USER \ Control Panel \ International \ Locale from 0000040C to 00000409. This made Java speak English.

Returning to the tool of the regional settings control panel, I noticed that this actually changed the name in the "Regional settings" section, while preserving all the French formatting for date numbers, etc.

So the page on the Sun is simple! Java does not get its default LOCALE from the settings on the extended page, but from the settings on the regional settings page - and they are very difficult to change without populating ALL of these options (i.e. you can’t just just change the language and leave the number / date format / etc as is).

Does anyone know how to get this information for Sun ???

+6
source

For me, changing HKEY_CURRENT_USER\Control Panel\International\LocaleName to en-US did the trick. Changing Locale, as Martin Bartlett suggested, did not help.

+3
source

I am not sure how to do this with Oracle java. Does the java properties user.language , user.country and user.variant ?

0
source
  • user.language and user.country, you can try the following examples:
     java -Duser.language = sv -Duser.country = SE
     java -Duser.language = en -Duser.country = US

  1. If you want jvm to choose it by default, you must set the environment variable JAVA_TOOL_OPTIONS , it also works on windows (except that the environment variable is slightly different from windows) !
     export JAVA_TOOL_OPTIONS = "- Duser.language = en -Duser.country = US"

See this question for more information on JAVA_TOOL_OPTIONS .

0
source

All Articles