我想我已将task.json
和launch.json
设置为正确。
tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"taskName": "Compile Java",
"type": "shell",
"command": "javac ${file}",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
以下是launch.json
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Java",
"type": "java",
"request": "launch",
"stopOnEntry": true,
"externalConsole": false,
"preLaunchTask": "Compile Java",
"jdkPath": "${env:JAVA_HOME}/bin",
"cwd": "${fileDirname}",
"startupClass": "${fileBasenameNoExtension}",
"classpath": [
"/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/lib",
".",
"${fileDirname}"
]
},
{
"name": "Java Console App",
"type": "java",
"request": "launch",
"stopOnEntry": true,
"preLaunchTask": "Compile Java",
"jdkPath": "${env:JAVA_HOME}/bin",
"cwd": "${fileDirname}",
"startupClass": "${fileBasenameNoExtension}",
"classpath": [
"/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/lib",
".",
"${fileDirname}"
],
"externalConsole": true
}
]
}
但是当我单击调试按钮时,没有任何反应,调试控制台中没有任何内容:
和顶部的暂停按钮,我点击它但没有任何反应。 然后我设置了一个断点,但看起来像试图进入这个程序: