CMD command when compiling Java programs: Non-mapped characters encoded GBK

Source: Internet
Author: User

Cause: Since the JDK is an international version, at compile time, if we do not specify the encoding format of the Java source program with the-encoding parameter, Then Java.exe first get us to do the system default encoding format, that is, when compiling Java program, if we do not specify the source program file encoding format, the JDK first obtains the operating system's file.encoding parameter (it saves the operating system default encoding format, such as Win2K, his value is GBK), The JDK then translates our Java source program into memory from the file.encoding encoded format to the Java internal default Unicode format. After that, Javac compiles the converted Unicode file into a class file, At this point the. class file is Unicode encoded, it is placed in memory, and the JDK then saves this Unicode-encoded. class file into the operating system to form the. class file that we see. But when we compile without setting, the equivalent of using parameters: Javac-encoding GBK Xx.java, there will be incompatibilities.

Workaround: You should use the-encodin parameter to specify the encoding method: Javac-encoding UTF-8 Xx.java.

CMD command when compiling Java programs: Non-mapped characters encoded GBK

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.