简体   繁体   中英

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. 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). 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. See below sample output (from 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. So I believe that your javac prints messages in Chinese that is not supported by your terminal. 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.

See the following discussion . Try their recommendations how to turn command prompt to be UTF8-compliant.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM