-
JDK17及以前:在Custom VM Options中增加
-Dfile.encoding=UTF-8 -
JDK18:在Run->Edit Configurations中增加VM Options:
-Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -
JDK19到JDK21:在Run->Edit Configurations中增加VM Options:
-Dstdout.encoding=UTF-8 -Dstderr.encoding=UTF-8 -
环境变量
JAVA_TOOL_OPTIONS可以传递到子进程,解决套娃java进程乱码问题