Paul - The Programmer

simple & stupid
Fix the Jython console on my Windows XP
Hide Vim menu bar and tool bar

Configure javac to report messages in English

paul posted @ Sun, 21 Feb 2010 06:41:53 +0800 in coding life with tags java , 2041 readers

On my Chinese version Windows XP, the javac always shows Simple Chinese messages. But I'd rather see the English ones.

The traditional way is to change the default system Local setting, then the JVM local is changed as well. But this solution is too inconvenient and painful.

Fortunately, we do not have to do that. We can pass the '-J-Duser.language' option to the javac to change its JVM Local setting.

e.g.

javac '-J-Duser.language=en -J-Duser.country=GB' -help

 The javac will show the help messages in English instead of the Simple Chinese.

Those two options can also be passed in the ant script by adding the <compilerarg> in the <javac>

e.g.

<target name="compile" description="compile hello world">
       <mkdir dir="${classes}"/>
       <javac srcdir="${src}" destdir="${classes}"  fork="true" >
           <compilerarg value="-J-Duser.language=en"/>
           <compilerarg value="-J-Duser.country=GB"/>
       </javac>
</target>

The attribute fork="true" is mandatory. The two options can only effect the forked compiler.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.

Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter