This question already has answers here:
How do I debug “Error: spawn ENOENT” on node.js?

(27 个回答)


4年前关闭。




我正在尝试在 Visual Studio Code 中调试 java 应用程序并收到以下错误:
"Error:spawn jdb ENOENT".
Vs Code 建议更新我的 launch.json,其中包含以下内容:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Java",
            "type": "java",
            "request": "launch",
            "stopOnEntry": true,
            "cwd": "${fileDirname}",
            "startupClass": "${fileBasename}",
            "options": [
                "-classpath",
                "\"${fileDirname};.\""
            ]
        },
        {
            "name": "Java Console App",
            "type": "java",
            "request": "launch",
            "stopOnEntry": true,
            "cwd": "${fileDirname}",
            "startupClass": "${fileBasename}",
            "options": [
                "-classpath",
                "\"${fileDirname};.\""
            ],
            "externalConsole": true
        }
    ]
}

我正在使用 maven 构建并安装了以下 VSCode 插件 https://github.com/DonJayamanne/javaVSCode

Maven pow.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
    http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.ams-sample</groupId>
  <artifactId>AMSSample</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>NumberGenerator</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
  <groupId>com.microsoft.azure</groupId>
  <artifactId>azure-storage</artifactId>
  <version>4.0.0</version>
   <scope>system</scope>
    <systemPath>${basedir}/lib/azure-storage-4.0.0.jar</systemPath>
</dependency>
 <dependency>
  <groupId>com.microsoft.azure</groupId>
  <artifactId>azure-core</artifactId>
  <version>0.9.4</version>
   <scope>system</scope>
   <systemPath>${basedir}/lib/azure-core-0.9.0.jar</systemPath>
</dependency>
     <dependency>
  <groupId>com.microsoft.azure</groupId>
  <artifactId>azure-media</artifactId>
  <version>0.9.4</version>
  <scope>system</scope>
  <systemPath>${basedir}/lib/azure-media-0.9.0.jar</systemPath>
</dependency>
  </dependencies>
</project>

我现在假设 VS Code 无法找到 jdb.exe,我正在尝试找到应该配置它的位置。

最佳答案

问题与缺少指向 C:\Program Files\Java\jdk1.8.0_102\bin 的 %PATH% 相关。一旦系统变量 %PATH% 被修改为包含 C:\Program Files\Java\jdk1.8.0_102\bin VS Code 启动 java 调试器。

10-08 05:43
查看更多