vscode-java icon indicating copy to clipboard operation
vscode-java copied to clipboard

Runtime at `'/home/user/.sdkman/candidates/java/21.ea.28-open'` is not compatible with the `'JavaSE-21'` environment"

Open GavinRay97 opened this issue 2 years ago • 2 comments

Environment
  • Operating System: WSL2 Fedora Rawhide
  • JDK version: 21.ea.28-open
  • Visual Studio Code version:
Version: 1.80.0-insider (user setup)
Commit: c1bca6d7cc2c5f71ae04deda90c0cf50819ffde4
Date: 2023-06-29T07:44:44.659Z
Electron: 22.3.14
ElectronBuildId: 21893604
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Windows_NT x64 10.0.22631
  • Java extension version: v1.21.2023063004 Pre-Release
Steps To Reproduce

Configure .vscode/settings.json like below:

{
    "java.jdt.ls.java.home": "/home/user/.sdkman/candidates/java/21.ea.28-open",
    "java.configuration.runtimes": [
        {
            "name": "JavaSE-21",
            "path": "/home/user/.sdkman/candidates/java/21.ea.28-open",
            "default": true
        }
    ]
}
Current Result
[Error - 5:09:27 PM] Jun 30, 2023, 5:09:27 PM Runtime at '/home/user/.sdkman/candidates/java/21.ea.28-open' is not compatible with the 'JavaSE-21' environment
[Trace - 5:09:27 PM] Received notification 'telemetry/event'.
Params: {
    "name": "java.ls.error",
    "properties": {
        "message": "Runtime at '/home/user/.sdkman/candidates/java/21.ea.28-open' is not compatible with the 'JavaSE-21' environment"
    }
}
Expected Result

It works

Additional Informations

Setting name to JavaSE-20 makes it work

GavinRay97 avatar Jun 30 '23 21:06 GavinRay97

Related issue #2255 Cannot add Java 18+ runtime to java.configuration.runtimes without mislabeling it as JavaSE-17 or below.

Allowed runtime name list https://github.com/redhat-developer/vscode-java/blob/master/package.json#L793

Java 21 BETA implementation progress https://github.com/eclipse-jdt/eclipse.jdt.core/issues?q=milestone%3ABETA_JAVA21

cypher256 avatar Aug 31 '23 08:08 cypher256

"Allowed runtime name list"??? And I if I have two versions of Java 24 installed (say Zulu and OpenJdk) how I am supposed to switch between the two? I guess there must be a very good reason for imposing this limitation...

DavideRossi avatar Apr 25 '25 15:04 DavideRossi