IDEA使用tomcat启动服务控制台乱码解决

1. 问题描述:

image

 

2. 原因分析

IDEA编码与Tomcat编码不一致导致。

3. 解决办法

将IDEA编码和Tomcat编码统一设置为UTF-8即可。

修改默认编码
  • 文件 > 设置 > 编辑器 > 文本编码(汉化IDEA)
  • File > Settings > Editor > File Encoding

将下图中三处编码修改为UTF-8,如下:

image

 

编辑VM选项

在菜单中找到帮助中的编辑VM options选项,Help > Edit Custom VM Options,如图:

image

 在行末尾加入一行:

-Dfile.encoding=UTF-8

修改Tomcat的编码

找到本地Tomcat的文件夹所在位置,依次打开Tomcat目录下的 config > logging.properties,使用记事本打开,Ctrl + F 搜索 ConsoleHandler.encoding,看是否是UTF-8,不是的话修改或添加一行

重启IDEA即可

posted @ 2025-09-24 09:37  🍒lychee.wang  阅读(71)  评论(0)    收藏  举报