esensar/neovim-java

Class file has wrong version 55.0, should be 52.0

HiPhish opened this issue · 2 comments

Hello,

I want to use this library to write a Java remote plugin for Neovim, but when I try to build using Gradle I get the following error message:

> Task :compileJava FAILED
/home/hiphish/Developer/vim/gradle.nvim/src/main/java/org/gradle/tooling/nvim/Tooling.java:5: error: cannot access NeovimApi
import com.ensarsarajcic.neovim.java.api.NeovimApi;
                                        ^
  bad class file: /home/aleksandar/.gradle/caches/modules-2/files-2.1/com.ensarsarajcic.neovim.java/neovim-api/0.1.13/433f7d4917d8b7cb13944eac0418e07f47c0b73a/neovim-api-0.1.13.jar(com/ensarsarajcic/neovim/java/api/NeovimApi.class)
    class file has wrong version 55.0, should be 52.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.

FAILURE: Build failed with an exception.

I have added the following to my default generated build.gradle file:

dependencies {
    // ...

    // Neovim API client library
    implementation 'com.ensarsarajcic.neovim.java:neovim-api:0.1.13'
    // Gradle Tooling API
    implementation 'org.gradle:gradle-tooling-api:4.3'

    // ...
}

From what I understand it appears that the library Gradle has downloaded was compiled using Java 11, while I am using Java 8. Is there a way of getting the library in a Java 8 compatible form?

Hello,
Sorry, but I don't think this library can be used with Java 8. Is there a specific reason you are not migrating to newer version? If it is a new project, you should try never JDK version.

OK, thank you for the information. It would be good to have the minimum requirements listed in the README.

Is there a specific reason you are not migrating to newer version?

Yes, there is: I want to make a Neovim plugin which integrates with the Gradle tooling API. Gradle exposes a Java API to control it through. The problem is, I want to also use Neovim at work (because I'm a weirdo who does not use IDEs), but we are stuck with Java 8 there. It doesn't matter though, I found out today that it is possible to use a different JVM for running Gradle itself, and for running the actual build process. Being able to write everything in one version of Java would have made it more convenient, but at least I can work around the issue. Oh well, at least I will now get to use some of the nice improvements to the language.

Everything builds fine with Java 11, but I have not not been able to figure out how to run the language server with Java 11 yet.

EDIT: In case anyone comes across this, I got the language server running; first I had to adjust the parameters passed to the server according to the official instructions (this part is obvious), but then I also had to delete the workspace directory created by the language server. The workspace directory is what is passed after the -data command-line argument. Otherwise I would keep getting classpath errors everywhere.