kotlin-language-server icon indicating copy to clipboard operation
kotlin-language-server copied to clipboard

This version of the Java runtime only recognises class files versions up to 52.0

Open ChildishhAlbino opened this issue 2 years ago • 3 comments
trafficstars

Trying to set this up with a project I use at work and NeoVim (NvChad) and ran into this error.

We're using Kotlin 1.2 and OpenJDK version "1.8.0_312"

2023-06-08 at 12 57 pm

ChildishhAlbino avatar Jun 08 '23 03:06 ChildishhAlbino

The language server is compiled using Java 11, so I guess that might cause issues. Have you tried running the language server using Java 11 instead? (even if your project target Java 8, it might be a good workaround to get the language server working)

themkat avatar Jun 21 '23 15:06 themkat

@ChildishhAlbino I faced this issue a while ago I don't exactly remember the workaround, but I think you just need to install java 11 on your system(not even set the java home to 11). This is my java home and installations:

❯ /usr/libexec/java_home -V
Matching Java Virtual Machines (3):
    19.0.2 (arm64) "Amazon.com Inc." - "Amazon Corretto 19" /Library/Java/JavaVirtualMachines/amazon-corretto-19.jdk/Contents/Home
    17.0.7 (arm64) "Amazon.com Inc." - "Amazon Corretto 17" /Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk/Contents/Home
    11.0.19 (arm64) "Amazon.com Inc." - "Amazon Corretto 11" /Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/amazon-corretto-19.jdk/Contents/Home

Other thing which might have fixed the issue for me was to clone the repo and build the executable myself. Give these a try.

Glyphack avatar Jun 28 '23 14:06 Glyphack

Oh cheers for the advice - I'll give that a try @themkat @Glyphack

ChildishhAlbino avatar Jun 28 '23 14:06 ChildishhAlbino