解决IntelIij DEA控制台乱码

当控制台有中文时可能会出现乱码问题:

1、中文乱码问题出现在启动时打印的日志中,例如

解决方法;

点击导航栏中的  Help——Edit Custom VM Options

在最后一行添加

-Dfile.encoding=utf-8 

 最后一定要重启IDEA

2、System.out在控制台中打印中文时,也可能出现乱码

解决方法:

添加虚拟机参数

-Dfile.encoding=utf-8 

需要添加多个参数时,需要空格隔开,例如

-Dlog4j.skipJansi=false -Dfile.encoding=utf-8 

  

原文地址:https://www.cnblogs.com/phdeblog/p/13153572.html