"Unmappable character encoding GBK" error when compiling Java files with Javac

Premise: JDK version >= 1.6 will cause a compilation error, before 1.6 it will only be a warning

 

Here is the javac document:

 

The reason for this situation is:

The file encoding format is different from the encoding chosen by the compiler to compile, and this error is caused when there are comments with non-English characters.

 

Solution:

1: Change the file save format to save in ANSI format - you can open the file with Notepad, click Save As, and save it in ANSI mode

2: Change the java compilation encoding to UTF-8

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325374780&siteId=291194637