You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I see that you have a PR #244 to change jdk but I don't understand how to use it. I have openjdk 17 and 21 on my machine and need to run projects on them. This is my setup (based on https://github.com/nvim-lua/kickstart.nvim):
jdtls= {
settings= {
java= {
configuration= {
runtimes= {
{
name='openjdk-17',
path=java_paths['17'],
default=true,
},
{
name='openjdk-21',
path=java_paths['21'],
},
},
},
},
},
},
...require('mason-lspconfig').setup {
ensure_installed= {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)automatic_installation=false,
handlers= {
function(server_name)
localserver=servers[server_name] or {}
-- This handles overriding only values explicitly passed-- by the server configuration above. Useful when disabling-- certain features of an LSP (for example, turning off formatting for ts_ls)if'jdtls' ==server_namethenrequire('java').setup {
spring_boot_tools= { enable=true, version='1.55.1' },
jdk= { auto_install=false },
}
endserver.capabilities=vim.tbl_deep_extend('force', {}, capabilities, server.capabilitiesor {})
require('lspconfig')[server_name].setup(server)
end,
},
}
ok, I found that Macos use another settings for runtime path. For anyone who may encounter this situation in the future, here is how I make it work: you have to point java path to JAVA_HOME, that's it.
Activity
kien5436 commentedon Apr 10, 2025
update: I tried
JavaSettingsChangeRuntimeand changed runtime version to 21 but errors still theres1n7ax commentedon Apr 14, 2025
Try clearing cache.
https://github.com/nvim-java/nvim-java/wiki/Troubleshooting#no_entry-how-to-clean-rebuild
kien5436 commentedon Apr 15, 2025
ok, I found that Macos use another settings for runtime path. For anyone who may encounter this situation in the future, here is how I make it work: you have to point java path to JAVA_HOME, that's it.