1

I'm trying to use the java-language-server vscode extension, but I am getting an error that the extension is not starting up:

[Error - 11:07:14 AM] Starting client failed
Error: spawn UNKNOWN
    at ChildProcess.spawn (internal/child_process.js:403:11)
    at Object.spawn (child_process.js:570:9)
    at c:\Users\tdalt\.vscode-insiders\extensions\georgewfraser.vscode-javac-0.2.39\node_modules\vscode-languageclient\lib\main.js:357:40

Looks like that line is trying to run this script: dist\lang_server_windows.sh. When I manually run that script, I get this error:

/mnt/c/Users/tdalt/.vscode-insiders/extensions/georgewfraser.vscode-javac-0.2.39/dist/launch_windows.sh: 13: /mnt/c/Users/tdalt/.vscode-insiders/extensions/georgewfraser.vscode-javac-0.2.39/dist/windows/bin/java: not found

which makes me think that something needs to run before that script runs.

Haven't looked much more into it than that. I have heard good things about this extension, but just haven't been able to get it working. Has anyone run into this issue before or is able to help me resolve it?

My java -version results in

openjdk version "11.0.9.1" 2020-11-04 LTS
OpenJDK Runtime Environment Zulu11.43+55-CA (build 11.0.9.1+1-LTS)
OpenJDK 64-Bit Server VM Zulu11.43+55-CA (build 11.0.9.1+1-LTS, mixed mode)

Operating System: Windows 11 Home v22000.493
VS Code: VSCode-Insiders (Latest version)

As a side note, if anyone has a good vscode bazel setup for Java, I would love to hear any tips on setup.

tim117
  • 244
  • 2
  • 14
  • If you really want a working Java language server running, use Red Hat extension, https://marketplace.visualstudio.com/items?itemName=redhat.java All others can be risky as they have significantly less users and the developers might not be able test in all possible setup (like yours, Windows 11 with WSL). – Lex Li Feb 27 '22 at 21:30
  • I tried that pulgin, but it still doesn't seem to have bazel support https://github.com/redhat-developer/vscode-java/issues/909. – tim117 Feb 27 '22 at 22:34
  • @Timothy Altemus Bazel is not supported well in the VSCode for now. But Maven and Gradle work well in the VSCode. Bazel is perfect, but you can also take into account maven or Gradle. – Steven-MSFT Mar 24 '22 at 06:58

1 Answers1

0

I had the same problem. You're probably trying this as a Windows Standard User. This worked for me...Log out of your Standard User Windows session and log into Windows as an Admin user and then run 'VS Code' (make sure the Java extensions are present within this Admin instance of 'VS Code'). You should then be able to debug Java code avoiding the error (although the JDK will request access through Windows firewall if not already granted). Once granted, quit 'VS Code' and the Admin Windows session. Log back into Windows as Standard User, Right-click 'VS Code' and Run As Administrator and use your Admin account to run 'VS Code' It should function normally after that, just keep in mind that VS Code is running under your Windows Admin account.