views:

341

answers:

1

My PC is currently set up as Japanese for testing purposes. If my java project has a compilation error the message is reported in Japanese.

e.g. Compiling 1 source file to [...directory...] [...class...].java:172: シンボルを見つけられません。

I would prefer to see the errors in english.

Without using ant the fix for this is to use javac -J-Duser.language=en [..java files...] which makes javac give english error messages (the -J tells javac to pass the rest of the argument to java)

My question is: how do I pass this to ant [editted to remove options I tried that didn't work]

+1  A: 

Try adding a <compilerarg> to your <javac> call. For example:

<javac srcdir="${src.dir}" destdir="${classes.dir}" fork="true">
    <compilerarg value="-J-Duser.language=en"/>
    <compilerarg value="-J-Duser.country=GB"/>
</javac>

EDIT Fixed the arg values. Also, this only works if the compiler is forked; I updated the example to reflect that.

Jason Day