Skip to content

bug: Classpath not being given to jdtls #359

@filiptrplan

Description

@filiptrplan

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)

v0.10.4

Operating system/version

OpenSUSE Tumbleweed

Describe the bug

When defining a project with .project and .classpath, it doesn't detect the libraries given .classpath correctly.

Steps To Reproduce

I have the following folder structure:

  • lib/ this is where I keep my JARs
  • src/ this is where I keep the source code

My .classpath file:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER" />
	<classpathentry kind="src" path="src" />
	<classpathentry kind="lib" exported="true" path="lib/antlr-4.13.2-complete.jar" />
	<classpathentry kind="output" path="bin" />
</classpath>

When I try to use the ANTLR JAR in a file like this I get an error:

Image

The code compiles just fine with the following command:

javac --release 22 -encoding UTF8 --module-path lib/antlr-4.13.2-complete.jar --source-path src -d bin src/compiler/Compiler.java

Interestingly I managed to get it work with a series of deleting / adding files incrementally and now it works fine. I backed up the cache folder just in case. If I delete the workspace in the .cache folder and re-open the project, it goes back to throwing errors.

Expected Behavior

It should detect the JAR normally and not give me errors. I'm also attaching the :LspLog output.

[START][2025-02-19 22:56:59] LSP logging initiated
[ERROR][2025-02-19 22:56:59] .../vim/lsp/rpc.lua:770	"rpc"	"/opt/jdk-23//bin/java"	"stderr"	"WARNING: Using incubator modules: jdk.incubator.vector\n"
[ERROR][2025-02-19 22:57:00] .../vim/lsp/rpc.lua:770	"rpc"	"/opt/jdk-23//bin/java"	"stderr"	"Disabling server log output. No more output will be sent after this.\n"
[ERROR][2025-02-19 22:57:00] .../vim/lsp/rpc.lua:770	"rpc"	"/opt/jdk-23//bin/java"	"stderr"	"Feb 19, 2025 10:57:00 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-02-19 22:57:00] .../vim/lsp/rpc.lua:770	"rpc"	"/opt/jdk-23//bin/java"	"stderr"	"Feb 19, 2025 10:57:00 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-02-19 22:57:02] ...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-02-19 22:57:02] ...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"
[ERROR][2025-02-19 22:57:03] ...lsp/handlers.lua:623	"Feb 19, 2025, 10:57:03 PM Failed to load extension bundles \nLoad bundle list\norg.eclipse.core.runtime.CoreException: Load bundle list\n\tat org.eclipse.jdt.ls.core.internal.handlers.BundleUtils.loadBundles(BundleUtils.java:173)\n\tat org.eclipse.jdt.ls.core.internal.handlers.InitHandler.handleInitializationOptions(InitHandler.java:113)\n\tat org.eclipse.jdt.ls.core.internal.handlers.BaseInitHandler.initialize(BaseInitHandler.java:68)\n\tat org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.initialize(JDTLanguageServer.java:284)\n\tat java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:580)\n\tat org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$recursiveFindRpcMethods$0(GenericEndpoint.java:65)\n\tat org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:128)\n\tat org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:271)\n\tat org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:201)\n\tat org.eclipse.jdt.ls.core.internal.ParentProcessWatcher.lambda$1(ParentProcessWatcher.java:144)\n\tat org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:185)\n\tat org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:97)\n\tat org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:114)\n\tat java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)\n\tat java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)\n\tat java.base/java.lang.Thread.run(Thread.java:1575)\nContains: Failed to get bundleInfo for bundle from /home/filip/.local/share/nvim/mason/share/spring-boot-tools/jars/commons-lsp-extensions.jar\nContains: Failed to get bundleInfo for bundle from /home/filip/.local/share/nvim/mason/share/spring-boot-tools/jars/xml-ls-extension.jar\n"
[WARN][2025-02-19 22:57:03] ...lsp/handlers.lua:135	"The language server jdtls triggers a registerCapability handler for workspace/didChangeWorkspaceFolders despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[ERROR][2025-02-19 22:57:04] ...lsp/handlers.lua:623	"Feb 19, 2025, 10:57:04 PM Command _java.reloadBundles.command not supported on client"
[ERROR][2025-02-19 22:57:04] .../vim/lsp/rpc.lua:770	"rpc"	"/opt/jdk-23//bin/java"	"stderr"	"Feb 19, 2025 10:57:04 PM com.microsoft.java.debug.plugin.internal.JavaDebuggerServerPlugin start\nINFO: Starting com.microsoft.java.debug.plugin\n"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions