Skip to content

Kotlin support in jdtls #4409

@bringonthepretty

Description

@bringonthepretty

Describe the bug
Trying to set up jdtls in nvim

Java works fine, but if i try to use kotlin files in java, it fails with "[ClassName] cannot be resolved to a type"
Code compiles and runs successfully, nothing wrong with it.
Considering this, jdtls should pick up kotlin files, but it does not in my case.

Currently I run jdtls with the following command:

java
-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
-Xmx1g
--add-modules=ALL-SYSTEM
--add-opens java.base/java.util=ALL-UNNAMED
--add-opens java.base/java.lang=ALL-UNNAMED
-javaagent: /path/to/lombok
-jar /path/to/jdtls/launcher
-configuration /path/to/linux/config
-data /path/to/data/dir

Project uses groovy gradle with plugins

id 'java'
id 'org.jetbrains.kotlin.jvm' version '2.4.0-Beta2'

Does jdtls require some additional configuration for kotlin?
Or is there something else I'm doing wrong?

To Reproduce
Steps to reproduce the behavior:

  1. Open any dual lang project, for example this project
  2. Open any java file
  3. Use any class, defined in kotlin file

Expected behavior
Kotlin classes are recognized by jdtls

Environment

  • Operating System: linux
  • JDK version: OpenJDK 26.0.1
  • Visual Studio Code version: -
  • Java extension version: -

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions