[英]javac and java are in wrong encoding and locale
I'm on Windows 7. The system locale is zh_CN and there's no way to change the OS's locale. 我在Windows 7上。系统区域设置为zh_CN,无法更改操作系统的区域设置。 When install java, it detected the system locale and therefore java and javac will, supposedly print its output in localized language (Chinese in this case).
安装java时,它会检测到系统区域设置,因此java和javac将以本地化语言(在这种情况下为中文)打印输出。 I don't want this behaviour but there's no way to change it.
我不希望这种行为,但是无法更改它。
However, it doesn't work. 但是,它不起作用。 I tried Cygwin, git bash and Win CMD, all print just question marks.
我尝试了Cygwin,git bash和Win CMD,所有这些仅打印问号。 See below sample output (from Cygwin):
请参见下面的示例输出(来自Cygwin):
Anyone has any idea how to make it output English? 任何人都知道如何使其输出英语吗? Any help is much appreciated!
任何帮助深表感谢!
我相信您可以使用以下命令执行此操作:
java -Duser.language=en -Duser.country=US ...
I compared your and my output of javac
and saw that in your case the text is much shorter. 我比较了您和我的
javac
输出,发现在您的情况下,文本要短得多。 So I believe that your javac prints messages in Chinese that is not supported by your terminal. 因此,我相信您的javac会以中文显示您的终端不支持的消息。 So, you should either teach your terminal Chinese or re-install JDK and choose English as a current interface language (if it is possible) or probably download English version of JDK.
因此,您应该教您的终端中文,或者重新安装JDK并选择英语作为当前的界面语言(如果可能),或者可能下载JDK的英语版本。
See the following discussion . 请参阅以下讨论 。 Try their recommendations how to turn command prompt to be UTF8-compliant.
尝试他们的建议,如何使命令提示符兼容UTF8。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.