我的系统是中文版的,当我的Java程序出现错误时,可能会输出一些非英语的错误信息,导致我无法阅读:
Caused by: java.io.IOException: CreateProcess error=2, 系统脮也禄碌陆指露
或者:IOException occured : Cannot run program "cmd /C tsc hello.ts":
CreateProcess error=2, ϵͳÕҲ»µ½ָ¶
是否有可能让Java始终输出英文错误信息?
我的系统是中文版的,当我的Java程序出现错误时,可能会输出一些非英语的错误信息,导致我无法阅读:
Caused by: java.io.IOException: CreateProcess error=2, 系统脮也禄碌陆指露
或者:IOException occured : Cannot run program "cmd /C tsc hello.ts":
CreateProcess error=2, ϵͳÕҲ»µ½ָ¶
是否有可能让Java始终输出英文错误信息?
Java displays error messages based on the default locale. There are three system properties which define the default locale: user.language
, user.country
and user.variant
. If you have access to your Java VM command line you can set these properties using the -D
command line switch. E.g. this is enough to switch Java to generic English:
java -Duser.language=en com.my.Class
You can define a JAVA_TOOL_OPTIONS
environment variable and specify your options there. Any JVM starting in such environment will pick these options up as if they were on the command line.