VSCode调试java控制台输入:Evaluation failed because the thread is not suspended

版权声明:原创不易,转载须经作者同意 https://blog.csdn.net/zhichaosong/article/details/89301155

使用 VS Code 调试 Java 程序,需要使用控制台输入,结果一直报错,找了一下解决方案

报错如下:
报错
.vscode/launch.json添加一行 "console": "externalTerminal"即可

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "Debug (Launch)-main<test>",
            "request": "launch",
            "mainClass": "main.main",
            "projectName": "test",
            "console": "externalTerminal"
        }
    ]
}

运行效果如下:
运行效果
出现此报错的原因是:VSCode 的内置调试控制台不支持 Java 输入。所以需要在debug配置文件里修改调试控制台,只需将 console 属性修改为 externalTerminal 即可。即外置终端。

猜你喜欢

转载自blog.csdn.net/zhichaosong/article/details/89301155
今日推荐