为什么在使用Java时,Visual Studio Code会在实际输出之前显示路径?

huangapple go评论61阅读模式
英文:

Why does Visual Studio Code shows path before the actual output When using Java

问题

为什么在运行程序时,VSC会显示这个?

英文:

为什么在使用Java时,Visual Studio Code会在实际输出之前显示路径?

why does vsc show this when running the program

答案1

得分: 1

就像 @Alexander Makarov 所说,这些是执行脚本,VS Code 会显示它们,以便开发者了解这个过程中发生了什么。

从你的截图中,我们可以知道:

  1. 你正在对一个项目进行调试,这是你的调试脚本执行路径;

  2. 这个过程使用 jdk-14 作为 Java 版本进行编译,编码风格是 UTF-8;

  3. 当前项目缓存存储在这个目录中;

  4. hello 是当前调试的 .java 文件的名称。

这是 VS Code 提供的默认设置,如果你不喜欢这样,@anurag saxena 也提供了一种方法,另外安装扩展 Code Runner 也是另一个选择。在 settings.json 中添加以下代码:

"code-runner.clearPreviousOutput": true,
"code-runner.showExecutionMessage": false,

然后每次运行代码时,在输出之前就不会有执行脚本了。

英文:

Just like @Alexander Makarov said, these are execution scripts and VS Code displays them to let developers know what's going on during this process.

为什么在使用Java时,Visual Studio Code会在实际输出之前显示路径?

From your screenshot, we can know:

  1. You're debugging a project and this is your debug script execution path;

  2. This process uses jdk-14 as java version to compile, and coding style is UTF-8;

  3. The current project cache is stored in this directory;

  4. hello is the name of current debugging .java file.

This is a default setting provided by VS Code, and if you don't like it, @anurag saxena had provided a way, also installing the extension Code Runner is another choice. Add the following code in settings.json:

"code-runner.clearPreviousOutput": true,
"code-runner.showExecutionMessage": false,

Then every time you run code, there's no execution script before the ouput.

答案2

得分: 0

这是在VS Code中的默认行为,所以要隐藏不必要的信息,你可以按照以下步骤操作:

首先,进入 "偏好设置"(preferences)-> "设置"(settings),然后搜索 (Java › Debug › Settings: Console)。将其设置从默认值更改为 (internalconsole),然后保存。这样就可以在调试控制台上获得不带终端路径的输出。

英文:

That's the default behavior in VS code, so to hide unnecessary info
you can go in

preferences-> settings and search for (Java › Debug › Settings: Console) Change its setting from default to (internalconsole) and that's it. you will get a terminal path free output on debug console

huangapple
  • 本文由 发表于 2020年9月28日 09:26:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/64094837.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定