It's minimal, but I'm posting things.
I manage my runtime versions using asdf.
Running Java LSPs like eclipse-jdt-ls in Vim becomes painful when using version managers like asdf.
You need to override the default command provided by the vim-lsp-settings project.
Specifically, the LSP needs your to explicitely export JAVA_HOME and add your Java runtime executable to the PATH env variable to function.
This reusable s:SafeLspCmd helper validates the executable and constructs the command list, supporting environment variable injection via a prefix list.
Using this helper prevents seeing error messages if the executable is not found on your system.
function! s:SafeLspCmd(executable, script_path, ...) abort
if !executable(a:executable) | return [] | endif
if !empty(a:script_path) && !filereadable(a:script_path) | return [] | endif
if a:0 >= 1 && type(a:1) == v:t_list
let l:prefix = a:1
let l:rest = a:000[1:]
else
let l:prefix = []
let l:rest = a:000
endif
return [a:executable] + l:prefix + [a:script_path] + l:rest
endfunction
Use the helper with env to inject JAVA_HOME and PATH before launching eclipse-jdt-ls.
let g:lsp_settings = {
\ 'eclipse-jdt-ls': {
\ 'cmd': {server_info->s:SafeLspCmd(
\ 'env',
\ lsp_settings#exec_path('eclipse-jdt-ls') . 'eclipse-jdt-ls',
\ ['JAVA_HOME=' . expand('~/.asdf/installs/java/openjdk-21'),
\ 'PATH=' . expand('~/.asdf/installs/java/openjdk-21/bin') . ':' . $PATH])}
\ }
\ }
Now the Java LSP should start properly; you can check with the :LspStatus command.