jhipster / jhipster-ide

An IDE for the JHipster Domain Language
https://jhipster.github.io/jhipster-ide
127 stars 37 forks source link

UnsupportedClassVersionError after installing the plugin #370

Closed robertmarkbram closed 4 years ago

robertmarkbram commented 4 years ago

Describe the bug

UnsupportedClassVersionError after installing the plugin.

To Reproduce Steps to reproduce the behavior:

  1. Installed the plugin.
  2. See error

    Exception in thread "main" com.google.inject.ProvisionException: Guice provision errors:
    
    Error injecting constructor, java.lang.UnsupportedClassVersionError: io/github/jhipster/jdl/ide/JDLIdeSetup has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

    Full stack trace: jhipster-vscode-plugin-error.txt

Expected behavior

No error.

Desktop (please complete the following information):

colameo commented 4 years ago

This is because you still use Java 8 and with the latest release of the extension JDK 11 is required. Let's go away from very old stuff ... there is really no reason to stay on Java 8

robertmarkbram commented 4 years ago

Fair enough. This should be documented in the project page so people know there is requirement on a specific minimum version of Java.

colameo commented 4 years ago

btw if you need java 8 for your project you can change the java.home as follows:

"java.home": "jdk-8-path" to "java.home": "jdk-11-path"

and keep the rest of the settings as it is and you should be able to build your project with JDK 11 but Java 8 compatibility.

colameo commented 4 years ago

...I mean in the workspace settings on Visual Studio Code

robertmarkbram commented 4 years ago

I already have that in my settings.json have that and am still seeing the error.

    "java.home": "C:\\Program Files\\Java\\jdk-14.0.1",
colameo commented 4 years ago

ah, no it's not possible - you need java 11 and above compatibility because I changed some parts of the extension to java 11 syntax... maybe I was too fast in switching java version (I'm working since ~2 years with java 11 syntax and personally I do not want to miss it anymore). However, I will investigate what I can do ...

robertmarkbram commented 4 years ago

This is because you still use Java 11 and the latest Java is JDK 14. Let's go away from very old stuff ... there is really no reason to stay on Java 11.

:)

colameo commented 4 years ago

...hm, Java 11 is a LTS version - so let's not run too fast ;-)

robertmarkbram commented 4 years ago

Somehow this is still a JDK 8 issue though (I do have JDK 8, 11 and 14 installed).

I changed my settings.json to

"java.home": "C:\\Program Files\\Java\\jdk-11.0.8",

But I still get the same error, which is definitely saying "I want JDK 11 but you used JDK 8":

Exception in thread "main" com.google.inject.ProvisionException: Guice provision errors:

1) Error injecting constructor, java.lang.UnsupportedClassVersionError: io/github/jhipster/jdl/ide/JDLIdeSetup has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Something needs to be recompiled?

colameo commented 4 years ago

ok, that's strange I will investigate

colameo commented 4 years ago

can you attach your settings.json?

robertmarkbram commented 4 years ago

Here you are, from C:\Users\Robert Bram\AppData\Roaming\Code\User\settings.json:

settings.json.txt

colameo commented 4 years ago

can you paste the output of java -version here?

robertmarkbram commented 4 years ago

That's not good. When I open a terminal within VS Code I get:

$ java -version
java version "1.8.0_261"
Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)
colameo commented 4 years ago

that's exactly the reason why it's not working

robertmarkbram commented 4 years ago

That sucks. It's not using the JDK version I set in VS Code.

colameo commented 4 years ago

as I said I will have a look on how to improve/check this but in the meantime set jdk 11 as default and it will work.

colameo commented 4 years ago
image
colameo commented 4 years ago

fixed