idea tool Chinese garbled

The first time I used IntelliJ IDEA to write a helloword program, the console output Chinese garbled characters during runtime . As shown in the following figure: ​​Cause : IntelliJ IDEA tool is compatible with the latest jdk18 version

solution:

Option 1: (recommended method) Replace the jdk version, recommend the jdk17 version or the jdk1.8 version, both of which are the official long-term supported and updated versions of java.

The steps to replace jdk are as follows:

 Click the settings icon in the upper right corner, click to enter the project structure option, as shown in the figure:​​ Enter the page shown in the figure below, click the module option, click the dependency option on the right, select the path where the correct version of jdk is located, and then apply and click OK. ​ ​​ ​ Next , run the program to see if the problem is solved. ​​ ​Solution 2: (Not recommended solution) Force conversion of project encoding.

Click Settings to select, click Editor, as shown in the following figure:​​​ Click File Encoding, change to UTF-8 in the project encoding on the left ​​​ The default encoding of the file is also changed to UTF-8, and then confirm to change. ​​​ If it still doesn’t work, replace the GBK in the lower right corner of the console with UTG-8. ​​​ The above If it is not clear, we need to constantly explore and practice when using it, and experience it by ourselves. Only in this way can we have a better understanding of the idea. Hope the above will help you

Guess you like

Origin juejin.im/post/7118178898570903588