williamboman / mason.nvim

Portable package manager for Neovim that runs everywhere Neovim runs. Easily install and manage LSP servers, DAP servers, linters, and formatters.
Apache License 2.0
7.24k stars 258 forks source link

failed to install java-language-server on Windows #1539

Open sangshuduo opened 8 months ago

sangshuduo commented 8 months ago

I've searched open issues for similar requests

I've manually reviewed logs to find potential errors

I've recently downloaded the latest plugin version of mason.nvim

Problem description

I failed to install java-language-server via MasonInstall with neovim on Windows.

The output:

  ▼ Displaying full log
    Cloning git repository "https://github.com/georgewfraser/java-language-server.git"…
    Cloning into '.'...
    From https://github.com/georgewfraser/java-language-server
     * tag               v0.2.39    -> FETCH_HEAD
    /bin/bash: .scriptslink_windows.sh: No such file or directory
    The JAVA_HOME environment variable is not defined correctly, 
    this environment variable is needed to run this program. 
    spawn: pwsh failed with exit code 1 and signal 0. 

Expected behavior

Install java-language-server smoothly.

Steps to reproduce

run MasonInstall java-language-server command

Affected packages

mason, java-language-server

Neovim version (>= 0.7)

NVIM v0.9.4 Build type: RelWithDebInfo LuaJIT 2.1.1696883897

Operating system/version

Windows 11

Healthcheck

mason: 

- ERROR No healthcheck found for "mason" plugin.

Screenshots or recordings

No response

williamboman commented 7 months ago

Hey and thanks for reporting! So for starters the java-language-server unfortunately requires Bash to be installed, even on Windows. It seems like you have Bash installed so that's not the issue. The error output suggests something else is going wrong with path separators being removed (.scriptslink_windows.sh should be ./scripts/link_windows.sh).

I have an idea of what could be wrong, I'll have to test some further the next time I'm on a Windows machine.

AsarNaufil commented 6 months ago

The JAVA_HOME environment variable is not defined correctly Have you set the variable in your environment? I recommend using :MasonInstall java-language-server@v0.2.32 from the reference https://github.com/georgewfraser/java-language-server/issues/255

SpacewaIker commented 6 months ago

I had the same issue and installing maven with scoop fixed it for me, even with the path separator issue in the link_windows.sh script.

doesDeveloper commented 2 months ago

any Update?