Name: eclipse.jdt.ls
Owner: Eclipse Foundation
Description: Java language server
Created: 2016-06-27 13:06:53.0
Updated: 2018-01-14 18:21:39.0
Pushed: 2018-01-16 00:02:23.0
Homepage: null
Size: 4017
Language: Java
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
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:
Fork and clone the repository
Install Eclipse Oxygen Java EE that will have most needed already installed. Alternatively, you can get the Eclipse IDE for Java developers and just install Eclipse PDE from the Eclipse Marketplace.
Once installed use File > Open Projects from File System...
and
point it at eclipse.jdt.ls
and Eclipse should automatically
detect the projects and import it properly.
If, after importing the projects, you see an error on pom.xml
about Tycho, you can use Quick Fix
(Ctrl+1) to install the Tycho maven integration.
At that point, some plug-ins should still be missing in order to build the project. You can either open org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target
in the Target Editor (which is the default editor) and click on Set Target Platform
, or alternatively, open Preferences > Plug-in Development > Target Platform
and select Java Language Server Target Definition
). Eclipse will take some time to download all the required dependencies. It should then be able to compile all the projects in the workspace.
The following command will install Apache Maven if necessary, then build the server into the /org.eclipse.jdt.ls.product/target/repository
folder:
$ ./mvnw clean verify
Note: currently, the build can only run when launched with JDK 8. JDK 9 can be used to run the server though.
Choose a connection type from “Managing connection types” section below, and then set those environment variables in your terminal prior to continuing
Make sure to build the server using the steps above in the “Building from command line” section
cd
into the build directory of the project: /org.eclipse.jdt.ls.product/target/repository
Prior to starting the server, make sure that your socket (TCP or sock file) server is running for both the IN and OUT sockets. You will get an error if the JDT server cannot connect on your ports/files specified in the environment variables
To start the server in the active terminal, run:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044 -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.protocol=true -Dlog.level=ALL -noverify -Xmx1G -jar ./plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar -configuration ./config_linux -data /path/to/data
When running with JDK9, you need to start the server with some extra parameters:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044 -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.protocol=true -Dlog.level=ALL -noverify -Xmx1G -jar ./plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar -configuration ./config_linux -data /path/to/data --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED
Choosing a value for -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
.
Choosing a value for -data
: the value for your data directory, should be the directory where your active workspace is, and you wish for the java langserver to add in its default files. Should also be the absolute path to this directory, ie., /home/username/workspace
Notes about debugging: the -agentlib:
is for connecting a java debugger agent to the process, and if you wish to debug the server from the start of execution, set suspend=y
so that the JVM will wait for your debugger prior to starting the server
Notes on jar versions: the full name of the build jar file above, org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
, may change incrementally as the project version changes. If java complains about jar not found, then look for the latest version of the org.eclipse.equinox.launcher_*
jar in the /org.eclipse.jdt.ls.product/target/repository/plugins
directory and replace it in the command after the -jar
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.
To use a plain socket, set the following environment variables before starting the server:
CLIENT_PORT
: the port of the socket to connect to
CLIENT_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 1.0, See LICENSE file.