-
-
Notifications
You must be signed in to change notification settings - Fork 83
bug: jdtls is not using jdk-21 #204
Description
Did you check docs and existing issues?
- I have read all the plugin docs
- I have searched the existing issues
- I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
0.10.0 release
Operating system/version
Arch Linux
Describe the bug
My default version of Java is 21, and I have set the default java path in lspconfig to the binary. When I attempt to run or debug, I receive an UnsupportedClassVersionError. I believe this is because openjdk-17 is hardcoded into the nvim-java plugin for builds, however it uses the specified runtime binary configured by lspconfig. I have resolved the issue by setting my default java runtime version to 17 and updating the required path, however it would be useful to be able to change the javac version as a config for the nvim-java in order to avoid ClassVersionErrors.
Steps To Reproduce
- Install java 21 using sdkman
- Set up nvim-java
- set up mason, mason-lspconfig and lspconfig.
- setup jdtls using lspconfig.
require("lspconfig").jdtls.setup({ settings = { java = { configuration = { runtimes = { { name = "JavaSE-21", path ="/PATH/TO/JAVA/RUNTIME/21", default = true, }, }, }, - Run debugger / JavaRunnerRunMain
Expected Behavior
nvim-java should use the same javac version as the currently specified runtime version configured by jdtls. An option to set the sdk used by nvim-java would also fix this issue.