问题现象

vscode 运行utf-8 java文,爆出如下错误
在这里插入图片描述

hello.java:5: ����: ����GBK�IJ���ӳ���ַ�
            // 你好�? �?
                   ^
hello.java:5: ����: ����GBK�IJ���ӳ���ַ�
            // 你好�? �?
                      ^
2 ������

解决方案

  1. Ctrl+,
  2. json方式查看,vscode setting json
  3. code-runner.executorMap的java 项改为
 "code-runner.executorMap": {
  		"java": "cd $dir && javac -encoding utf-8  $fileName && java -Dfile.encoding=utf-8 $fileNameWithoutExt",
 }

在这里插入图片描述
5. 关闭并重启VScode即可

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐