microsoft / microsoft/vscode-java-debug

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

Aperta
#978 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

ai-triaged bug launch terminal
Lingua principale
TypeScript
Stelle
591
Fork
429
Merge medio
1g 9h
PR unite (30g)
19

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Il problema si manifesta in scripts/launcher.bat e si verifica quando Run o Debug viene avviato con Ubuntu o WSL come shell predefinita. Riproduci questi passaggi su Windows 10, esamina come viene formato il comando del launcher e verifica il risultato sia in Bash sia in Fish; il lavoro è completato quando i programmi Java vengono eseguiti e sottoposti a debug senza l’errore “Command 'cmd' not found”.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java, typescript, vscode
Ambito
devtools, operating-systems
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.