MCPcopy Index your code
hub / github.com/eclipse-jdtls/eclipse.jdt.ls

github.com/eclipse-jdtls/eclipse.jdt.ls @v1.60.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.60.0 ↗ · + Follow
8,115 symbols 44,788 edges 917 files 989 documented · 12% updated 1d agohackathon_zrh · 2016-07-18★ 2,391411 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Build Status

Eclipse JDT Language Server

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:

  • Eclipse LSP4J, the Java binding for the Language Server Protocol,
  • Eclipse JDT, which provides Java support (code completion, references, diagnostics...),
  • M2Eclipse, which provides Maven support,
  • Buildship, which provides Gradle support.

Features

  • Supports compiling projects from Java 1.8 through 25
  • Maven pom.xml project support
  • Gradle project support (with experimental Android project import support)
  • Standalone Java files support
  • As-you-type reporting of syntax and compilation errors
  • Code completion
  • Javadoc hovers
  • Organize imports
  • Type search
  • Code actions (quick fixes, source actions & refactorings)
  • Code outline
  • Code folding
  • Code navigation
  • Code lens (references/implementations)
  • Code formatting (on-type/selection/file)
  • Code snippets
  • Highlights (semantic highlighting)
  • Semantic selection
  • Diagnostic tags
  • Call Hierarchy
  • Type Hierarchy
  • Annotation processing support (automatic for Maven projects)
  • Automatic source resolution for classes in jars with maven coordinates
  • Extensibility

Requirements

The language server requires a runtime environment of Java 21 (at a minimum) to run. This should either be set in the JAVA_HOME environment variable, or on the user's path.

Installation

There are several options to install eclipse.jdt.ls:

  • Download and extract a milestone build from http://download.eclipse.org/jdtls/milestones/
  • Download and extract a snapshot build from http://download.eclipse.org/jdtls/snapshots/
  • Under some Linux distributions you can use the package manager. Search the package repositories for jdtls or eclipse.jdt.ls.
  • Build it from source. Clone the repository via git clone and build the project via JAVA_HOME=/path/to/java/21 ./mvnw clean verify -U. 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.

Running from the command line

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
  1. Choose 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.
  2. Change the filename of the jar in -jar ./plugins/... to match the version you built or downloaded.
  3. Choose a value for -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.

Running from command line with wrapper script

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.

Development Setup

See Contributing

Managing connection types

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 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.

Feedback

Clients

This repository only contains the server implementation. Here are some known clients consuming this server:

  • vscode-java : an extension for Visual Studio Code
  • ide-java : an extension for Atom
  • ycmd : a code-completion and code-comprehension server for multiple clients
  • Oni : modern modal editing - powered by Neovim.
  • LSP Java : a Java LSP client for Emacs
  • Eclipse Theia : Theia is a cloud & desktop IDE framework implemented in TypeScript
  • Eclipse IDE JDT.LS : an extension for Eclipse IDE
  • coc-java : an extension for coc.nvim
  • MS Paint IDE : an IDE for programming in MS Paint
  • nvim-jdtls : an extension for Neovim
  • multilspy from monitors4codegen : A language-agnostic LSP client in Python, with a library interface. Intended to be used to build applications around language servers
  • OpenSumi : A framework that helps you quickly build Cloud or Desktop IDE products.

Continuous Integration Builds

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/.

License

EPL 2.0, See LICENSE file.

Extension points exported contracts — how you extend this code

IDelegateCommandHandler (Interface)
Interface for command handler to delegate the workspace/executeCommand A delegate that extends the core language server [6 …
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/IDelegateCommandHandler.java
Test (Interface)
(no doc) [6 implementers]
org.eclipse.jdt.ls.tests/projects/eclipse/declaration-test/src/TestSame.java
IFoo (Interface)
This is interface IFoo. [1 implementers]
org.eclipse.jdt.ls.tests.syntaxserver/projects/maven/salut4/src/main/java/pack/IFoo.java
ScannerTokenVisitor (Interface)
Visitor for IScanner tokens. [16 implementers]
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/semantictokens/SemanticTokensVisitor.java
FooInterface (Interface)
(no doc) [7 implementers]
org.eclipse.jdt.ls.tests/projects/eclipse/hello/src/org/sample/Highlight.java
NodeVisitor (Interface)
A node visitor may be used by helpers like #visitSimpleNameOfType(Name, NodeVisitor), and is responsible for the [17 implementers]
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/semantictokens/SemanticTokensVisitor.java
MyInterface (Interface)
(no doc) [26 implementers]
org.eclipse.jdt.ls.tests/projects/mixed/salut/src/main/java/org/sample/Bar.java
IPreferencesChangeListener (Interface)
A listener used to receive changes to preference values @author snjeza [10 implementers]
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/preferences/IPreferencesChangeListener.java

Core symbols most depended-on inside this repo

append
called by 14126
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/DocumentAdapter.java
createCompilationUnit
called by 1326
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/WorkspaceEventsHandler.java
size
called by 917
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/internal/gradle/checksums/WrapperValidator.java
add
called by 799
org.eclipse.jdt.ls.tests/projects/eclipse/hello/src/org/sample/MyList.java
put
called by 544
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/preferences/Preferences.java
append
called by 441
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/javadoc/HtmlToPlainText.java
filter
called by 412
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/SymbolUtils.java
isEmpty
called by 373
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/ResponseStore.java

Shape

Method 6,803
Class 1,018
Function 201
Interface 58
Enum 35

Languages

Java97%
TypeScript2%
Kotlin1%
Python1%

Modules by API surface

org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/preferences/Preferences.java270 symbols
org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/handlers/CompletionHandlerTest.java175 symbols
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/preferences/ClientPreferences.java96 symbols
org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/correction/LocalCorrectionQuickFixTest.java94 symbols
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/JDTLanguageServer.java94 symbols
org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/correction/UnresolvedMethodsQuickFixTest.java93 symbols
org.eclipse.jdt.ls.tests/testresources/java-doc/apidocs/jquery/jquery-1.10.2.js83 symbols
org.eclipse.jdt.ls.tests/testresources/java-doc/apidocs/jquery/external/jquery/jquery.js83 symbols
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/LocalCorrectionsSubProcessor.java80 symbols
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/JDTUtils.java72 symbols
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/code/ExtractFieldRefactoring.java71 symbols
org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/handlers/SignatureHelpHandlerTest.java62 symbols

For agents

$ claude mcp add eclipse.jdt.ls \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page