microsoft / microsoft/vscode-java-debug

"Command 'cmd' not found" when running Java code with WSL as the default profile

未关闭
#978 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

ai-triaged bug launch terminal
主要语言
TypeScript
星标
591
派生
429
平均合并
1 天 9 小时
30 天内合并 PR
19

描述

When running/debugging Java programs using the extension(s), while having WSL as the default terminal profile, the program can't be run and exits with the following error:

Command 'cmd' not found, but there are 17 similar ones.

fish:        
 cmd /C "c:\Users\<Username>\.vscode\extensions\vscjava.vscode-java-debug-0.32.1\scripts\launcher.bat "C:\Program Files\AdoptOpenJDK\jdk-11.0.10.9-hotspot\bin\java.exe" -Dfile.encoding=UTF-8 -cp C:\Users\<Username>\AppData\Roaming\Code\User\workspaceStorage\f2ff3effae7386c130fa74d8c23d1e02\redhat.java\jdt_ws\Izzivi_163d1b63\bin Izziv5 "

The error occurs on multiple shells (both Bash and Fish tested), so this is not a Fish-specific issue.

Calling cmd.exe instead of cmd might fix the issue, since cmd.exe is available from WSL, while just cmd isn't.

Environment
  • Operating System: Windows 10
  • JDK version: 11 (AdoptOpenJDK)
  • Visual Studio Code version: 1.55.1
  • Java extension version: (Java Extension Pack?) v0.13.0
  • Java Debugger extension version: v0.32.1
Steps To Reproduce
  1. Use Ubuntu (WSL) as the default shell
  2. Try to Run or Debug a Java project
  3. The runner/debugger fails with the above error

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

该故障显示在 scripts/launcher.bat 中,并且会在以 Ubuntu 或 WSL 作为默认 shell 启动 Run 或 Debug 时发生。在 Windows 10 上重现这些步骤,检查 launcher 命令是如何形成的,并在 Bash 和 Fish 中验证结果;当 Java 程序可以运行和调试且不出现“Command 'cmd' not found”错误时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, typescript, vscode
领域
devtools, operating-systems
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。