Skip to main content
Back to Extensions Directory
coc.nvim fallback icon

Java language extension for coc.nvim

Installation CommandVim prompt
:CocInstall coc-java
GitHub owner
Neoclide
Version
v1.56.0
npm package
coc-java
Requirements
coc >=0.0.82
License
EPL-1.0
Repository
GitHub
npm latest published 2026-08-22Registry checked 2026-08-23Registry summary

Published Package Summary

coc-java

Fork of vscode-java to works with coc.nvim.

Provides Java ™ language support via Eclipse ™ JDT Language Server, which utilizes Eclipse ™ JDT, M2Eclipse and Buildship.

Quick Start

  1. Install this extension by run command:
:CocInstall coc-java
  1. On the following platforms, the extension should activate without any setup : win32-x64, darwin-x64, darwin-arm64, linux-x64, linux-arm64.
    If on another platform, or using the "universal" version, you can set a Java Development Kit. It must be Java 17 or above.

  2. Optionally, download and install a Java Development Kit for your project (Java 1.5 or above is supported). See Project JDKs for more details

  3. Extension is activated when you first access a Java file

    • Recognizes projects with Maven or Gradle build files in the directory hierarchy.

Note: this extension comes with bunlded jdt.ls from 1.14.0, the same as vscode-java.

Project JDKs

If you need to compile your projects against a different JDK version, it's recommended you configure the java.configuration.runtimes property in your user settings, eg:

"java.configuration.runtimes": [
  {
    "name": "JavaSE-1.8",
    "path": "/path/to/jdk-8",
  },
  {
    "name": "JavaSE-11",
    "path": "/path/to/jdk-11",
  },
  {
    "name": "JavaSE-23",
    "path": "/path/to/jdk-23",
    "default": true
  },
]

The default runtime will be used when you open standalone Java files.

Features

  • Supports code from Java 1.5 to Java 23
  • Maven pom.xml project support
  • Gradle project support (with experimental Android project import support)
  • Standalone Java files support
  • As-you-type reporting of parsing and compilation errors
  • Code completion
  • Code/Source actions / Refactoring
  • Javadoc hovers
  • Organize imports
    • triggered manually (by :call CocAction('organizeImport')) or on save
    • when pasting code into a java file with Ctrl+Shift+v (Cmd+Shift+v on Mac)
  • Type search
  • Code outline
  • Code folding
  • Code navigation
  • Code lens (references/implementations)
  • Highlights
  • Code formatting (on-type/selection/file)
  • Code snippets
  • Annotation processing support (automatic for Maven projects)
  • Semantic selection
  • Diagnostic tags
  • Call Hierarchy
  • Type Hierarchy (:CocCommand java.action.showTypeHierarchy)
  • Share indexes (enabled by configuration java.sharedIndexes.enabled)

See the changelog for the latest release.

Semantic Highlighting

To enable semantic highlighting support, use configuration:

"semanticTokens.enable": true,

For java filetype only, use:

"[java]": {
  "semanticTokens.enable": true,
}

Checkout :h coc-configuration-scope.

Buffer not work

The jdt.ls requires buffer saved to disk to work, save the buffer by :w command and reload it by :e command in your vim. Or create the file on disk before buffer create.

Compiler warnings

To customize compiler warnings, create the file root_project/.settings/org.eclipse.jdt.core.prefs with values presented at https://help.eclipse.org/neon/topic/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/core/JavaCore.html

"Classpath is incomplete" warning

See https://github.com/redhat-developer/vscode-java/wiki/%22Classpath-is-incomplete%22-warning

Troubleshooting

  • Text OK would be in your statusline when jdt.ls is ready and you have statusline integration with coc.nvim. (could be configured by java.jdt.ls.statusIcons)
  • Run :CocOpenLog to get unexpected errors thrown by coc.nvim extensions.
  • Enable verbose trace for jdt.ls by add "java.trace.server": "verbose" in your settings file, then check output by :CocCommand java.open.output
  • Run :CocCommand java.open.serverLog to open log of jdt.ls.
  • Run :CocCommand java.open.clientLog to open extension Log File.
  • Try :CocCommand java.clean.workspace to clean workspace cache.

Feedback

License

EPL 1.0, See LICENSE for more information.

Read the complete README
  • Java language extension for coc.nvim
Activation Events
  • onLanguage:java
  • workspaceContains:pom.xml
  • workspaceContains:*/pom.xml
  • workspaceContains:build.gradle
  • workspaceContains:*/build.gradle
  • workspaceContains:settings.gradle
  • workspaceContains:*/settings.gradle
  • workspaceContains:build.gradle.kts
  • workspaceContains:*/build.gradle.kts
  • workspaceContains:settings.gradle.kts
  • workspaceContains:*/settings.gradle.kts
  • workspaceContains:.classpath
  • workspaceContains:*/.classpath
Developer Resources

Want to build, test, or contribute to coc.nvim extensions? Explore our official SDK and testing toolkits.

Open Developer Guide

Version History

Published with coc-java@1.56.0 as history.md.

Open source file

Change Log

1.56.0 (2026-08-22)

Major features

  • Synchronize Java language support with vscode-java 1.56.0, including Java 24-26 runtime definitions, newer JDT LS quick fixes and cleanups, and JSpecify null analysis defaults.
  • Add an extended Java outline that includes inherited members and supports direct navigation.
  • Support snippet-based workspace edits and whole-expression Java postfix completions.
  • Improve JDT LS startup and project discovery across Maven and Gradle multi-module workspaces, ARM hosts, Termux, Windows, and older coc.nvim versions, with a stdio transport fallback.

New settings

  • java.transport: Select pipe or stdio transport for JDT LS.
  • java.completion.lazyResolveTextEdit.enabled: Lazily resolve completion text edits.
  • java.codeGeneration.generateCommentsInMarkdown: Generate Markdown-style Javadoc comments.
  • java.templates.newFile.enabled: Control automatic type and package generation for new Java files.
  • java.templates.methodBody: Customize generated unimplemented method bodies.
  • java.templates.preferPackagePrivateVisibility: Prefer package-private visibility for new top-level types.
  • java.templates.methodBodySuper: Customize generated overriding method bodies that call super.
  • java.templates.catchBody: Customize generated catch block bodies.
  • java.hover.javadoc.enabled: Control Javadoc display in hovers.
  • java.referencesCodeLens.includeFields: Include fields in references CodeLens.
  • java.symbols.includeGeneratedCode: Include generated code in document symbols.
  • java.inlayHints.parameterNames.suppressWhenSameNameNumbered: Suppress redundant numbered parameter-name hints.
  • java.inlayHints.variableTypes.enabled: Show inferred variable type hints.
  • java.inlayHints.parameterTypes.enabled: Show inferred lambda parameter type hints.
  • java.inlayHints.formatParameters.enabled: Show format-specifier parameter hints.
  • java.search.scope: Select all, main, or projectOnly for references, call hierarchy, and workspace symbol searches.
  • java.jdt.ls.aspectjSupport.enabled: Enable AspectJ support for Gradle projects.
  • java.jdt.ls.kotlinSupport.enabled: Enable experimental Kotlin support for Gradle projects.
  • java.jdt.ls.scalaSupport.enabled: Enable experimental Scala support for Gradle projects.
  • java.jdt.ls.groovySupport.enabled: Enable experimental Groovy support for Gradle projects.
  • java.jdt.ls.appcds.enabled: Control experimental AppCDS startup optimization.

New commands

  • java.runtimes.add: Add Java Runtime.
  • java.change.searchScope: Change Java Search Scope.
  • java.action.copyFullyQualifiedName: Copy Fully Qualified Name.
  • java.action.showExtendedOutline: Open Extended Outline.

1.15.0 (2023-09-20)

  • performance - Skip generated methods when calculating document symbols.
  • performance - Make the debounce adaptive for the publish diagnostic job.
  • performance - Only perform context sensitive import rewrite when resolving completion items.
  • performance - Extension activation should not depend on language server being started.
  • enhancement - Support "extract interface" refactoring.
  • enhancement - Add "Convert String concatenation to Text Block" quick assist.
  • enhancement - Add clean up for using try-with-resource.
  • enhancement - Enable formatting support in syntax server.
  • enhancement - Add option to configure behaviour when mojo execution metadata not available.
  • enhancement - Add option to permit usage of test resources of a Maven project as dependencies within the compile scope of other projects.
  • bug fix - Change default generated method stub to throw exception.
  • bug fix - Prevent the paste handler for missing imports from generating overlapping text edits.
  • bug fix - Reference search doesn't work for fields in JDK classes.
  • bug fix - Paste event handling blocks pasting while project loading.
  • bug fix - Avoid generating boilerplate code repeatedly in new Java file.
  • bug fix - Completion results should include filtered (excluded) types if they are also present in the import declarations.
  • bug fix - Fix type hierarchy regression since VS Code 1.75.1.
  • bug fix - Re-publish diagnostics for null analysis configuration change when auto-build is disabled.
  • bug fix - Dependency Analytics extension popup shoud respect user choice.
  • bug fix - Only do full build for a configuration change when auto-build is enabled.
  • bug fix - The command to upgrade gradle should check for cancellation prior to updating metadata files.
  • bug fix - Fix incorrect ordering of completion items that use a decorator.
  • bug fix - Reduce the amount of logging from org.apache.http bundles.
  • documentation - Clarify the README quick start instructions.

1.14.1

  • Fix background task not finish during completion by avoid selection range request.
  • Fix an exception caused by undefined kind of WorkspaceSymbol on resolve.

1.14.0 (2023-01-29)

  • Synchronize with [email protected].
  • Standard launch mode is used by default, because bugs with Hybrid mode.