Wednesday, October 15, 2008

Display Chinese characters in Eclipse console

Recently, I have been working on a project for a Chinese company. As a result, I want to display Chinese characters in Eclipse console. I am using Eclipse 3.3. I don't want to change Regional and language settings for Windows XP since it will influence other programs. After searching with google, I find the following solution work for me. First, we need to configure the JRE we are using in Eclipse.

  1. In Preferences->Java->Installed JREs, choose the JRE you are using.

  2. Click Edit to show Edit JRE dialog

  3. Input -Dfile.encoding=UTF-8 in Default VM Arguments


Second, we need to configure all the Run (Debug) configurations.

  1. In Common tab, select UTF-8 as Console Encoding


Eclipse 3.4 does not have this prolem. It can display Chinese correctly by default.