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
I confirmed that this is not an issue with the Eclipse JDT Language Server itself
What happened?
I added a dependency to my build.gradle:
implementation 'commons-net:commons-net:3.12.0'
I would have expected it to be resolved within my file, but importing any of the dependencies returns: The import org.apache.commons.net cannot be resolved (Java 268435846)
Opening VScode resolves the dependency correctly; in fact, with ./gradlew build the project starts correctly.
What did you expect to happen?
It should automatically resolve dependencies once they are entered and built.
For now you should be able to fix this issue by recreating the .classpath file and the .factorypath one. I need to take a look at how the current VS Code extension triggers automatically such refresh for imports. Maybe it's trivial.
.classpath is an Eclipse file, how can I recreate it?
EDIT
Ok I've imported the 'eclipse' plugin in build.gradle and launched ./gradlew eclipse, now all it works. I don't think this is the correct procedure, however.
Try with ./gradlew dependencies --configuration compileClasspath
my build.gradle does not have a compileClasspath config, so it return error.
I don't known if this issue can be compared with Vscode because I've tried to reopen the project with it, clean the java workspace with the vscode command and none of this actions have recreated it or modified the .classpath.
I can do more tests if you want, actually I don't known how this plugin works but I suspect that it should provide some automations if it depends to some extra projects dependencies like "eclipse".
Including the eclipse plugin might indeed be the solution. The language server we are using, as well as VSCode, is eclipse.jdt.ls
I don't know because I've included the eclipse plugin in my project and I've tried to regenerate multiple times the classpath file without results. I can do some tests if you have some actions to try.
Ok I've imported the 'eclipse' plugin in build.gradle and launched ./gradlew eclipse, now all it works. I don't think this is the correct procedure, however.
After that you got correct suggestions and class information or did you have to do something additional?
Ok I've imported the 'eclipse' plugin in build.gradle and launched ./gradlew eclipse, now all it works. I don't think this is the correct procedure, however.
After that you got correct suggestions and class information or did you have to do something additional?
I did some tests and the only thing that worked was to delete the .classpath, .projects and .settings files from app. After doing this by running ./gradlew eclipse the paths worked without any problems.
Thanks for the details.
Reading about the topic on the language server repo, it should be able to understand the project type and trigger an automatic creation of the files it needs.
This import behavior can be set by providing initialization options to the server, you have an example of it in our Advanced configuration.
You might have the feature already enabled, and, as you had highlighted, this might cause unintended results.
I assume your class paths contained a relative path rather than an absolute one, causing the language server to fail obtaining
the required info.
Based on this reddit post it might actually be better to include in the project settings the eclipse plugin and invoking it manually.
In the effort of making this extension more polished, we have as of now a single option, provide a command or task to run either gradle eclipse or mvn eclipse:eclipse.
Updating a file within the project is not allowed as of now. Ideally otherwise, we would also update the project file to consume the eclipse plugin.
@sedax90 Take a look at #146. The same initialization options discussed there should resolve the issue you're facing.
If that works for you, I’ll prioritize adding proper documentation and an easy way to enable these options, instead of implementing tasks to manually run Eclipse-specific commands.
@sedax90 Take a look at #146. The same initialization options discussed there should resolve the issue you're facing. If that works for you, I’ll prioritize adding proper documentation and an easy way to enable these options, instead of implementing tasks to manually run Eclipse-specific commands.
@sedax90 I've updated the initialization options in PR#205 and those should improve the behavior of JDTLS with Gradle and Maven projects. Let me know whether those are going to improve the situation for you
@sedax90 I've updated the initialization options in PR#205 and those should improve the behavior of JDTLS with Gradle and Maven projects. Let me know whether those are going to improve the situation for you
I can confirm who with settings and cleaning the cache is working fine!
Is the .classpath file the same as the eclipse projects (XML file with <classpathentry> tags)? Or is there a documentation for the format somewhere (I haven't found it)?
I'm trying to solve the same issue, opening a workspace directory containing multiple Eclipse projects built with Ant (I'm hoping to switch from Eclipse to Zed for Java development).
Yes it is the same, we are using the same language server as Eclipse, JDTLS
Would you happen to know whether the kind="var" entries can be handled? It seems only the kind="lib" entries are recognized by JDTLS:
<classpathentrykind="lib"path="/path/to/libraries/commons-io-2.20.0.jar"/> <!-- Works -->
<classpathentrykind="var"path="lib/commons-net-3.12.0.jar"/> <!-- Does not work -->
The problem is that those variables are defined in the Eclipse Workspace, outside of the .classpath file.
If you think it would be useful, I could open a new ticket.
I changed kind="var" to kind="lib" and updated to absolute path and it is indeed working.
I'm not completely sure how the "var" kind it is handled inside the plugin/JDTLS but having a section somewhere in the plugin configuration where we could define such variables would be awesome. I tried exporting environment variables in the script that runs Zed and modifying the .classpath accordingly, to no avail:
run-zed:
export$LIBP=/path/to/libraries
zed $@
.classpath:
<classpathentrykind="lib"path="$LIBP/commons-net-3.12.0.jar"/> <!-- Does not work -->
Activity
tartarughina commentedon Nov 5, 2025
For now you should be able to fix this issue by recreating the .classpath file and the .factorypath one. I need to take a look at how the current VS Code extension triggers automatically such refresh for imports. Maybe it's trivial.
sedax90 commentedon Nov 5, 2025
I've remove the app/.classpath file but now I've lost autocomplete, errors, etc.
tartarughina commentedon Nov 5, 2025
You should recreate it, not delete it
sedax90 commentedon Nov 5, 2025
.classpath is an Eclipse file, how can I recreate it?
EDIT
Ok I've imported the 'eclipse' plugin in build.gradle and launched ./gradlew eclipse, now all it works. I don't think this is the correct procedure, however.
tartarughina commentedon Nov 5, 2025
Try with
./gradlew dependencies --configuration compileClasspathsedax90 commentedon Nov 5, 2025
my build.gradle does not have a compileClasspath config, so it return error.
I don't known if this issue can be compared with Vscode because I've tried to reopen the project with it, clean the java workspace with the vscode command and none of this actions have recreated it or modified the .classpath.
I can do more tests if you want, actually I don't known how this plugin works but I suspect that it should provide some automations if it depends to some extra projects dependencies like "eclipse".
sedax90 commentedon Nov 7, 2025
This is issue is still present also with classes manually created in the project externally, example with vscode:
tartarughina commentedon Nov 8, 2025
Including the
eclipseplugin might indeed be the solution. The language server we are using, as well as VSCode, is eclipse.jdt.lssedax90 commentedon Nov 8, 2025
I don't know because I've included the eclipse plugin in my project and I've tried to regenerate multiple times the classpath file without results. I can do some tests if you have some actions to try.
tartarughina commentedon Nov 8, 2025
You did the following
After that you got correct suggestions and class information or did you have to do something additional?
sedax90 commentedon Nov 10, 2025
I did some tests and the only thing that worked was to delete the .classpath, .projects and .settings files from
app. After doing this by running./gradlew eclipsethe paths worked without any problems.tartarughina commentedon Nov 10, 2025
Thanks for the details.
Reading about the topic on the language server repo, it should be able to understand the project type and trigger an automatic creation of the files it needs.
This import behavior can be set by providing initialization options to the server, you have an example of it in our Advanced configuration.
You might have the feature already enabled, and, as you had highlighted, this might cause unintended results.
I assume your class paths contained a relative path rather than an absolute one, causing the language server to fail obtaining
the required info.
Based on this reddit post it might actually be better to include in the project settings the eclipse plugin and invoking it manually.
In the effort of making this extension more polished, we have as of now a single option, provide a command or task to run either
gradle eclipseormvn eclipse:eclipse.Updating a file within the project is not allowed as of now. Ideally otherwise, we would also update the project file to consume the eclipse plugin.
tartarughina commentedon Dec 6, 2025
@sedax90 Take a look at #146. The same initialization options discussed there should resolve the issue you're facing.
If that works for you, I’ll prioritize adding proper documentation and an easy way to enable these options, instead of implementing tasks to manually run Eclipse-specific commands.
sedax90 commentedon Dec 11, 2025
I've added:
but I've some errors anyway:
sedax90 commentedon Feb 26, 2026
there's an estimation time when this issue will be resolved?
tartarughina commentedon Feb 26, 2026
@sedax90 have you tried to use the whole initialization options I've suggested in #146 (comment)?
sedax90 commentedon Feb 27, 2026
Yes I've reported it in #122 (comment)
tartarughina commentedon Mar 1, 2026
@sedax90 I've updated the initialization options in PR#205 and those should improve the behavior of JDTLS with Gradle and Maven projects. Let me know whether those are going to improve the situation for you
sedax90 commentedon Mar 6, 2026
I can confirm who with settings and cleaning the cache is working fine!
tartarughina commentedon Mar 6, 2026
Awesome, glad to hear the new init options are doing their job
matthieu-labas commentedon May 28, 2026
Is the
.classpathfile the same as the eclipse projects (XML file with<classpathentry>tags)? Or is there a documentation for the format somewhere (I haven't found it)?I'm trying to solve the same issue, opening a workspace directory containing multiple Eclipse projects built with Ant (I'm hoping to switch from Eclipse to Zed for Java development).
tartarughina commentedon May 28, 2026
Yes it is the same, we are using the same language server as Eclipse, JDTLS
matthieu-labas commentedon Jun 1, 2026
Would you happen to know whether the
kind="var"entries can be handled? It seems only thekind="lib"entries are recognized by JDTLS:The problem is that those variables are defined in the Eclipse Workspace, outside of the
.classpathfile.If you think it would be useful, I could open a new ticket.
tartarughina commentedon Jun 2, 2026
From a quick search I confirm what you said,
kind=varexpects to have some ENV vars available but those are created only within an Eclipse workspace.To confirm, would you convert the kind to lib and update the path to absolute?
matthieu-labas commentedon Jun 2, 2026
I changed
kind="var"tokind="lib"and updated to absolute path and it is indeed working.I'm not completely sure how the "var" kind it is handled inside the plugin/JDTLS but having a section somewhere in the plugin configuration where we could define such variables would be awesome. I tried exporting environment variables in the script that runs Zed and modifying the .classpath accordingly, to no avail:
run-zed:.classpath: