The Eclipse JDT Language Server is a Java language specific implementation of the Language Server Protocol and can be used with any editor that supports the protocol, to offer good support for the Java Language. The server is based on:
The language server requires a runtime environment of Java 17 (at a minimum) to run. This should either be set in the JAVA_HOME
environment variable, or on the user's path.
There are several options to install eclipse.jdt.ls:
jdtls
or eclipse.jdt.ls
.git clone
and build the project via JAVA_HOME=/path/to/java/17 ./mvnw clean verify
. Optionally append -DskipTests=true
to by-pass the tests. This command builds the server into the ./org.eclipse.jdt.ls.product/target/repository
folder.Some editors or editor extensions bundle eclipse.jdt.ls or contain logic to install it. If that is the case, you only need to install the editor extension. For example for Visual Studio Code you can install the Extension Pack for Java and it will take care of the rest.
If you built eclipse.jdt.ls from source, cd
into ./org.eclipse.jdt.ls.product/target/repository
. If you downloaded a milestone or snapshot build, extract the contents.
To start the server in the active terminal, adjust the following command as described further below and run it:
java \
-Declipse.application=org.eclipse.jdt.ls.core.id1 \
-Dosgi.bundles.defaultStartLevel=4 \
-Declipse.product=org.eclipse.jdt.ls.core.product \
-Dlog.level=ALL \
-Xmx1G \
--add-modules=ALL-SYSTEM \
--add-opens java.base/java.util=ALL-UNNAMED \
--add-opens java.base/java.lang=ALL-UNNAMED \
-jar ./plugins/org.eclipse.equinox.launcher_1.5.200.v20180922-1751.jar \
-configuration ./config_linux \
-data /path/to/data
-configuration
: this is the path to your platform's configuration directory. For Linux, use ./config_linux
. For windows, use ./config_win
. For mac/OS X, use ./config_mac
.-jar ./plugins/...
to match the version you built or downloaded.-data
: An absolute path to your data directory. eclipse.jdt.ls stores workspace specific information in it. This should be unique per workspace/project.If you want to debug eclipse.jdt.ls itself, add -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044
right after java
and ensure nothing else is running on port 1044. If you want to debug from the start of execution, change suspend=n
to suspend=y
so the JVM will wait for your debugger prior to starting the server.
There is also a Python wrapper script available that makes the start up of eclipse.jdt.ls more convenient (no need to juggle with Java options etc.). A sample usage is described below. The script requires Python 3.9.
./org.eclipse.jdt.ls.product/target/repository/bin/jdtls \
-configuration ~/.cache/jdtls \
-data /path/to/data
All shown Java options will be set by the wrapper script. Please, note that the -configuration
options points to a user's folder to ensure that the configuration folder in org.eclipse.jdt.ls.product/target/repository/config_*
remains untouched.
See Contributing
The Java Language server supports sockets, named pipes, and standard streams of the server process
to communicate with the client. Client can communicate its preferred connection methods
by setting up environment variables or alternatively using system properties (e.g. -DCLIENT_PORT=...
)
To use a plain socket, set the following environment variables or system properties before starting the server:
CLIENT_PORT
: the port of the socket to connect toCLIENT_HOST
: the host name to connect to. If not set, defaults to localhost
.The connection will be used for in and output.
To use standard streams(stdin, stdout) of the server process do not set any of the above environment variables and the server will fall back to standard streams.
For socket and named pipes, the client is expected to create the connections and wait for the server to connect.
This repository only contains the server implementation. Here are some known clients consuming this server:
Our CI server publishes the server binaries to http://download.eclipse.org/jdtls/snapshots/.
P2 repositories are available under http://download.eclipse.org/jdtls/snapshots/repository/.
Milestone builds are available under http://download.eclipse.org/jdtls/milestones/.
EPL 2.0, See LICENSE file.