sublimelsp / LSP-jdtls

Convenience package for the Eclipse JDT language server
https://packagecontrol.io/packages/LSP-jdtls
MIT License
30 stars 4 forks source link

Failing with Java 22 (Unsupported class file major version 66) #51

Closed soychpapalus closed 7 months ago

soychpapalus commented 7 months ago

  2 eclipse.buildId=unknown
  3 java.version=22
  4 java.vendor=N/A
  5 BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
  6 Command-line arguments:  -data /home/xxxx/.cache/sublime-text/Package Storage/LSP-jdtls/data
  7
  8 !ENTRY org.apache.aries.spifly.dynamic.bundle 4 0 2024-04-26 18:46:04.236
  9 !MESSAGE FrameworkEvent ERROR
 10 !STACK 0
 11 java.lang.IllegalArgumentException: Unsupported class file major version 66```

Steps I took:

1. Installed LSP package
2. Installed LSP-jdtls package
soychpapalus commented 7 months ago

Fixed it by following the following guide (with edits): https://lsp.readthedocs.io/en/stable/#java

Comments:

"command": [
    "java",
    "--add-modules=ALL-SYSTEM",
    "--add-opens",
    "java.base/java.util=ALL-UNNAMED",
    "--add-opens",
    "java.base/java.lang=ALL-UNNAMED",
    "-Declipse.application=org.eclipse.jdt.ls.core.id1",
    "-Dosgi.bundles.defaultStartLevel=4",
    "-Declipse.product=org.eclipse.jdt.ls.core.product",
    "-Dfile.encoding=UTF-8",
    "-DwatchParentProcess=true",  // false on windows, true other OSs
    "-Xmx1G",
    "-XX:+UseG1GC",
    "-XX:+UseStringDeduplication",
    "-jar",
    "~/.local/share/eclipse-jdt-server/plugins/org.eclipse.equinox.launcher_1.6.800.v20240330-1250.jar",
    "-configuration",
    "~/.local/share/eclipse-jdt-server/config_linux", // depending on the OS
    "-data",
    "/tmp/${project_base_name}/jdt_ws"
  ],
 "enabled": true,
  "languageId": "java",
  "scopes": ["source.java"],
  "syntaxes": ["Packages/Java/Java.sublime-syntax"]
}
palexdev commented 3 months ago

This plugin is broken The only way I got java working is by following the above instructions

LDAP commented 3 months ago

I need more info to fix this for everyone. LSP-jdtls version, LSP version, ST version, Windows/Mac/Linux? Also run the troubleshoot server command from the ST command panel.

palexdev commented 3 months ago

I need more info to fix this for everyone. LSP-jdtls version, LSP version, ST version, Windows/Mac/Linux? Also run the troubleshoot server command from the ST command panel.

Just now I tried to reproduce the issue but everything is working. I think 2627751 fixed it