Search code examples
javasublimetext

Sublime Text 3 and Java with language server jdt-ls


I have downloaded the jdt-ls as language server and configured as described here https://lsp.readthedocs.io/en/latest/#java

My project has source code which is in 'src/main' but sublime text (or jdt-ls) seems to assume that the source code lies in the root folder, i.e. every java file has a "wrong" package name. Is there a configuration for projects?


Solution

  • I found the solution. In the root of the project there must exist a .classpath file. Here is my file for example:

    <?xml version="1.0" encoding="UTF-8"?>
    <classpath>
      <classpathentry kind="src" path="src/main" output="bin/src/main"/>
      <classpathentry kind="src" path="src/test" output="bin/src/test"/>
      <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
      ...
    </classpath>