Search code examples
linuxjavalocale

Java automatically format date info. in other language


My system is Linux 64bit, and my JDK is icedtea. My system can display Chinese, but it is not set as the primary language of the system, nor for the desktop environment. But when I run java applications, it automatically formats the date object using Chinese...weird.

How can I force java to use the primary system language to format date objects, if the formatting language is not set in the application?


Solution

  • Basically, the problem is caused by the setting of your Linux system locale. In my case, the LC_CTYPE was set to zh_CN.UTF-8. Simply set it to en_US.UTF-8 solves my problem.