.Java file encoding problem when you compile the project under Intellij Idea

The "encoded problem .java files compiled" found at compile time .java files, a need to specify the correct coding scheme, the coding scheme for decoding the byte stream .java files.
Then in use Intellij Idea compiled (assuming javac compiler tool) project all .java files, how to specify the correct encoding scheme it?
1) First of all, we need to know when to perform "Make Project" command under the "Build" menu compiling .java files in the entire project, Intellij Idea specific commands to perform. We can get the following ways, perform "Generate Ant Build" command under the "Build" menu, generates an Ant Build File, and then by the Ant Build File, we can get specific command Intellij Idea executed when compiling the entire project . [1]

 

When 2) Ant Build File by means of 1) can be found Intellij Idea .java files compiled program, the specific command is "javac commands with various parameters." There is a "-encoding" parameter, which is used to specify the encoding scheme should be used when compiling the .java files, as shown in FIG. Intellij Idea itself have a mechanism for determining the value of the parameter tested, the values ​​are likely to come from "Project Encoding" configuration, shown in Figure 2; .java likely to come from a file is detected to be used Intellij Idea encoding schemes, see the link; also possible parameters from the compiler shown in FIG. 3 and the like. Specific mechanisms need access to relevant documents.

                                                                                                      figure 1

 

 

                                                                                                                                           figure 2

 

 

 

                                                                                                                                        image 3

 

 

 

3) consists of two) available, Intellij Idea itself have a mechanism to determine the "-encoding" parameter values, but often the last to be determined value is not what we want. And "encoding" parameter is a very important parameter, in order to more accurately specify the "-encoding" parameter, we can explicitly configure "-encoding xxx" parameter in the compiler configuration shown in Figure 3.

 

references:

[1]http://stackoverflow.com/questions/2966530/can-i-see-the-exact-commands-intellij-uses-to-build-a-java-project
---------------------
作者:AllInCode
来源:CSDN
原文:https://blog.csdn.net/dslztx/article/details/47010113/

Guess you like

Origin www.cnblogs.com/xiaoshen666/p/11127840.html