Failed to start the program, Error: spawn ${/usr/lib/jvm/default-java}/bin/java ENOENT
这是我在使用Visual-Studio Code调试我的java代码时遇到的错误。
我的程序名称是 sample.java ,它存储在 〜/ Desktop / Data / VScode 目录。我正在开发 Ubuntu 16.04LTS 。 和Java版本是 oracle JDK-9.0.1
这是我的 launch.json 文件
{
// 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": [
{
"name": "Java",
"type": "java",
"request": "launch",
"stopOnEntry": true,
"jdkPath": "${/usr/lib/jvm/default-java}/bin",
"cwd": "$~/Desktop/Data/VScode",
"startupClass": "${sample}",
"classpath": [
".",
"${~/Desktop/Data/VScode}"
]
},
{
"name": "Java Console App",
"type": "java",
"request": "launch",
"stopOnEntry": true,
"jdkPath": "${/usr/lib/jvm/default-java}/bin",
"cwd": "${~/Desktop/Data/VScode}",
"startupClass": "${sample}",
"classpath": [
".",
"${~/Desktop/Data/VScode}"
],
"externalConsole": true
}
]
}
这是我的 task.json 文件
{
"version": "2.0.0",
"tasks": [
{
"taskName": "Compile Java",
"type": "shell",
"command": "javac -g sample.java",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}