一、配置系統編碼為UTF-8
一次點擊File—>Settings —> Editor —> File Encoding
1.將Global Encoding、Project Encoding的編碼格式切換為UTF-8
2.將Properties Files下的Default encoding for properties files的編碼格式切換為UTF-8,並將其后的 選擇框勾選上 。
二、編輯VM
-
點擊 Help --> Custom VM Options
-
在底部添加
-Dfile.encoding=UTF-8
三、配置Tomcat
3.1配置server
- 點擊運行按鈕Run左邊的Edit Configurations,選擇Tomcat中的Server。
在VM options中添加
-Dfile.encoding=UTF-8
3.2配置Startup/Connection
在上一步的界面中,切換到右邊的Startup/Connection
- 在環境變量Environment Variables中添加鍵值對:
JAVA_TOOL_OPTIONS
-Dfile.encoding=UTF-8