hhopec
hhopec

Reputation: 11

How to stop JDTLS quitting ("Exit code 13 and signal 0") every time I open a java file in neovim?

I am fairly new to using neovim and set things up with kickstart.nvim. I tried to setup jdtls to run with mason. It was working fine until today, when it has been quitting immediately upon opening of a java file with the message "Exit code 13 and signal 0".

Here's were I've got to with my mason stuff (please see my full init.lua and config for context):

      local servers = {
        lua_ls = {
          settings = {
            Lua = {
              runtime = { version = 'LuaJIT' },
              workspace = {
                checkThirdParty = false,
                library = {
                  '${3rd}/luv/library',
                  unpack(vim.api.nvim_get_runtime_file('', true)),
                },
              },
              completion = {
                callSnippet = 'Replace',
              },
            },
          },
        },
        jdtls = {
          root_dir = vim.fs.dirname(vim.fs.find({ 'gradlew', '.git', 'mvnw' }, { upward = true })[1]),
        },
        angularls = {},
        html = {},
        ts_ls = {},
      }

      vim.list_extend(ensure_installed, {
        'stylua', -- Used to format Lua code
      })
      require('mason-tool-installer').setup { ensure_installed = ensure_installed }

      require('java').setup {}

      require('mason-lspconfig').setup {
        handlers = {
          function(server_name)
            local server = servers[server_name] or {}
            server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
            require('lspconfig')[server_name].setup(server)
          end,
        },
        ensure_installed = ensure_installed,
        automatic_installation = true,
      }
    end,
  },

Here is the output in the lsp log file:

[START][2025-01-13 22:21:45] LSP logging initiated
[ERROR][2025-01-13 22:21:45] .../vim/lsp/rpc.lua:770    "rpc"   "/Users/hopecah/.local/share/nvim/mason/bin/java"   "stderr"    "WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign\n"
[ERROR][2025-01-13 22:21:45] .../vim/lsp/rpc.lua:770    "rpc"   "/Users/hopecah/.jenv/versions/21.0.3/bin/java" "stderr"    "Disabling server log output. No more output will be sent after this.\n"
[ERROR][2025-01-13 22:21:46] .../vim/lsp/rpc.lua:770    "rpc"   "/Users/hopecah/.local/share/nvim/mason/bin/java"   "stderr"    "Jan 13, 2025 10:21:46 PM org.apache.aries.spifly.BaseActivator log\nINFO: Registered provider ch.qos.logback.classic.servlet.LogbackServletContainerInitializer of service jakarta.servlet.ServletContainerInitializer in bundle ch.qos.logback.classic\n"
[ERROR][2025-01-13 22:21:46] .../vim/lsp/rpc.lua:770    "rpc"   "/Users/hopecah/.local/share/nvim/mason/bin/java"   "stderr"    "Jan 13, 2025 10:21:46 PM org.apache.aries.spifly.BaseActivator log\nINFO: Registered provider ch.qos.logback.classic.spi.LogbackServiceProvider of service org.slf4j.spi.SLF4JServiceProvider in bundle ch.qos.logback.classic\n"
[WARN][2025-01-13 22:27:15] ...lsp/handlers.lua:135 "The language server spring-boot triggers a registerCapability handler for workspace/didChangeWorkspaceFolders despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[WARN][2025-01-13 22:27:15] ...lsp/handlers.lua:135 "The language server spring-boot triggers a registerCapability handler for textDocument/semanticTokens despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[START][2025-01-13 22:28:14] LSP logging initiated
[ERROR][2025-01-13 22:28:14] .../vim/lsp/rpc.lua:770    "rpc"   "/Users/hopecah/.local/share/nvim/mason/bin/java"   "stderr"    "WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign\n"
[ERROR][2025-01-13 22:28:15] .../vim/lsp/rpc.lua:770    "rpc"   "/Users/hopecah/.jenv/versions/21.0.3/bin/java" "stderr"    "Disabling server log output. No more output will be sent after this.\n"
[ERROR][2025-01-13 22:28:15] .../vim/lsp/rpc.lua:770    "rpc"   "/Users/hopecah/.local/share/nvim/mason/bin/java"   "stderr"    "Jan 13, 2025 10:28:15 PM org.apache.aries.spifly.BaseActivator log\nINFO: Registered provider ch.qos.logback.classic.servlet.LogbackServletContainerInitializer of service jakarta.servlet.ServletContainerInitializer in bundle ch.qos.logback.classic\n"
[ERROR][2025-01-13 22:28:15] .../vim/lsp/rpc.lua:770    "rpc"   "/Users/hopecah/.local/share/nvim/mason/bin/java"   "stderr"    "Jan 13, 2025 10:28:15 PM org.apache.aries.spifly.BaseActivator log\nINFO: Registered provider ch.qos.logback.classic.spi.LogbackServiceProvider of service org.slf4j.spi.SLF4JServiceProvider in bundle ch.qos.logback.classic\n"

When I have had problems with it before it was usually because I needed to clean install my java project I'm working on but this is not the case this time. I've done that like 10 times.

Extra info: I'm using jenv and its running java version 21.0.3

I have tried every answer I've found on github, stackoverflow and reddit, including trying to just use nvim-jdtls with a ftplugin/java.lua file instead of my kickstart generated init.lua, deleting all the jdtls files in the mason folder and making it remake them etc. But nothing is helping.

I did see someone suggest clearing eclipse cache but I don't know where that exists or how to identify it.

I've been working on this for about 12 hours and I've tried a ridiculous amount of setups, please can someone explain what I'm doing wrong here?

Upvotes: 1

Views: 435

Answers (1)

noen
noen

Reputation: 406

I had the same issue. You have to update your Java to version >=21.

Upvotes: 1

Related Questions